Even the most ardent Deadhead will admit the Grateful Dead had its on nights and its off nights. But in 1991 — 25 years into the legendary San Francisco band’s career and four years before its demise — the on nights vastly outnumbered the off nights, and to hear one expert tell it, the on nights were magical.

“Deadheads refer to the X-factor, and when the Dead had it, they were an untouchable band,” says the Dead’s archivist and legacy manager, David Lemieux, on the phone with The Post to promote the Grateful Dead Meet-Up at the Movies, which this year spotlights the Dead’s June 17, 1991, concert at Giants Stadium. “And that happens on that night, where they’re completely focused and engaged. The seven guys on stage, they were clicking on all cylinders as a one-man unit, and that to me is when the Grateful Dead are really, really peaking, and this show has that.”

The Meet-Up on Aug. 1 — Jerry Garcia’s birthday — will mark the ninth year for the event in movie theaters and the first time it will have a global reach, thanks to film distributor Trafalgar Releasing.

The show, which features classics like “Eyes of the World,” “Truckin'” — which The Post is premiering — “Uncle John’s Band” and “Sugar Magnolia,” features Bruce Hornsby on piano, accordion and vocals. Hornsby, coming off solo stardom with a Best New Artist Grammy and the hit song “The Way It Is,” joined the band along with keyboardist Vince Welnick after the death of Brent Mydland.

“So you got this new sound of the Grateful Dead and new inspiration,” Lemieux says. “You can’t underestimate what Bruce brought to the band. The band realized, ‘We have to stand a little taller,’ as with Vince, but Vince didn’t come with the pedigree of Bruce’s recent success.

“It was a whole new sound of the Dead. … When you open with ‘Eyes’ and weave ‘Dark Star’ in and out of the setlist half a dozen times, here they were trying new things.”

While the Dead are inextricably linked to their Bay Area home, the New York City metro area was always fertile ground for the band. “New York’s got the ways and means,” says Lemieux, quoting Robert Hunter’s lyrics in “Truckin’. “

Jerry Garcia famously said when they played Madison Square Garden, ‘That place is juiced.’ It’s packed with energy, and they could feel it.

“I think they loved going there, I really do think they could feel it,” he says. “As much as any band, probably even more, they were feeding off the energy they were getting from the crowd. New York City audiences are unmatched for that.

“Jerry Garcia famously said when they played Madison Square Garden, ‘That place is juiced.’ It’s packed with energy, and they could feel it.”

The band stopped recording and touring as the Grateful Dead after the iconic guitarist and singer Garcia died in 1995. However, the group continues to live on in other ways.

“The Grateful Dead, I think, have two very important things going for them and it’s why 24 years later we’re still talking about them,” Lemieux says. “They recorded a lot of shows, and every show is completely unique and there’s been a drive to make the archive accessible. And the band members’ current activities are so vital — Dead and Company, Bob Weir’s Wolf Bros., Phil Lesh and Friends and the drummers’ projects. And then the tribute bands like Joe Russo’s Almost Dead and Dark Star Orchestra. There are lots of ways to get your live Grateful Dead fix.”

The archival releases, which Lemieux oversees, include a new box set he’ll be unveiling during next week’s screening, and “Dave’s Picks,” a limited-edition, thrice-yearly, full-show series. The latest “Dave’s Picks” (Vol. 31 from a 1979 Chicago show) sold out all 20,000 copies in six hours, so Lemieux recommends fans sign up for the band’s newsletter at Dead.net so they don’t miss out on future gems from the vault.