TV

‘Limitless” ‘Ferris Bueller’ episode is packed with movie Easter eggs

“Limitless,” the new CBS drama based on a 2011 movie, will pay homage to a completely different film — “Ferris Bueller’s Day Off.”

Tuesday night’s episode, titled “Brian Finch’s Black Op” (10 p.m.), is the brainchild of “Limitless” showrunner Craig Sweeny, a longtime fan of the 1986 John Hughes classic that starred Matthew Broderick, Mia Sara and Alan Ruck.

“It was so mischievous; the way it broke what I understood at the time to be the rules of making movies — it had Matthew Broderick talking directly to the camera and telling us to go away at the end of the movie,” Sweeny tells The Post. “I do think that [‘Limitless’] shares that sense of humor of the movie, and that sense of mischief, so it seemed like a natural match.”

Tuesday’s episode opens with a nearly shot-for-shot re-creation of the movie’s opening scene, with Brian (Jake McDorman) feigning illness in order to take a day off and enjoy his newly acquired personal supply of the brain-boosting drug NZT outside FBI supervision. But his dreams of a Ferris Bueller-worthy day of greatness are quickly sidetracked.

“He winds up getting abducted. We don’t realize it at the time, but there’s been a trade made above the heads of our characters and he’s been loaned to the CIA to be used in an operation,” Sweeny says. “The conceit of the episode is [that] the homage is all filtered through Brian’s head — because even after he’s been taken into this very serious and dangerous situation, he still is sort of clinging to the fantasy.”

Brian (McDorman) and Rebecca (Jennifer Carpenter) — look very similar to Ferris Bueller (Matthew Broderick) and Sloane (Mia Sara) in the 1986 movie (inset).CBS; Everett Collection

That manifests itself through plenty of “Ferris Bueller” Easter eggs: When the CIA operatives won’t tell Brian their names, he nicknames them Cameron, Rooney and Abe Froman, after several of the film’s characters (Ruck played played Cameron Frye). During an NZT trip, his FBI colleague Rebecca (Jennifer Carpenter) appears to him to offer advice dressed as Ferris’ girlfriend, Sloane (played in the movie by Mia Sara). There’s even a re-creation of the movie’s final scene where Principal Rooney gets picked up by a school bus — scored to the iconic “Oh Yeah” theme song.

“There are references sprinkled all throughout, at the very obvious level and then there’s little quotes of dialogue that you’d have to be a bigger fan of the movie to get,” Sweeny says.

Unlike “The Goldbergs,” which cast Charlie Sheen in its “Ferris”-inspired episode last season, “Limitless” didn’t approach any movie cast members for cameos.

“I don’t think it would have quite worked to cast Mia Sara, as much as we like her as an actress,” Sweeny says.