Your eyes weren’t playing tricks on you. That really was Jimmy Fallon and Drew Barrymore making out on the field as the Boston Red Sox celebrated their first World Series victory since 1918.

In a case of art imitating life, the stars of the upcoming Farrelly brothers movie “Fever Pitch” were shooting a new happy ending, which has been cobbled together furiously in the wake of the Sox’ historic run to the world championship.

So as Curt Schilling, Kevin Millar, Jason Varitek and the rest of the players swarmed the infield at St. Louis’ Busch Stadium Wednesday night after the Sox’ four-game sweep of the Cardinals, Fallon and Barrymore were in the middle of the madness, with the Farrellys’ camera following them.

Brothers Peter and Bobby, who are directing the movie about a Red Sox fan who’s torn between the woman he loves and the baseball team he worships, realized they needed a different ending once the Sox came back from a 3-0 deficit to beat the New York Yankees in the American League championship series last week.

“Until then, we didn’t allow ourselves to dream that it could happen,” Bobby Farrelly said Friday by phone from Toronto, where the rest of “Fever Pitch” is being shot. “You know how superstitious everyone is in Boston. We felt like if we started writing before that, we’d jinx them.”

The Farrellys, lifelong Sox fans from Cumberland, R.I., who spent two weeks shooting at Fenway Park last month, asked screenwriters Lowell Ganz and Babaloo Mandel to tweak the script to make it about a winning team.

Trending stories,celebrity news and all the best of TODAY. This site is protected by recaptcha

“It works brilliantly at the end,” Bobby Farrelly said. “We didn’t want to try to fictionalize it, but now it’s reality.”

The brothers, whose previous movies include “There’s Something About Mary” and “Kingpin,” scrambled Wednesday to make sure they were filming inside Busch Stadium in case the Sox swept.

Ordinarily, only players and accredited media are allowed on the field — a restriction put in place after stars like Susan Sarandon and Tim Robbins celebrated in the Mets’ locker room and Billy Crystal repeatedly spent time in the Yankees’ in 2000. But major league baseball made an exception because of the Farrellys’ previous access at Fenway, MLB spokesman Pat Courtney said.

“The first inclination was to make sure they’re not directly involved in the action,” Courtney said. “You can accomplish both — you can have the team celebrating and, in an unobtrusive manner, still enable (the filmmakers) to get what they need.”

He added: “At that point, there were so many different groups of media and television in that whole mix, with them off to the side.”

Not everyone was satisfied, though.

The Boston Globe’s Names section Friday asked major league baseball: “Have you no shame? Why, as the Red Sox deliriously celebrated their first World Series win in 86 years Wednesday, were Jimmy Fallon and Drew Barrymore on the field?”

It continued: “Confused? Appalled? We were, too.”

Bobby Farrelly said the criticism doesn’t sting.

“It’s OK — you know why? Now that we won, what are they going to say? The naysayers are going to talk about something, people are used to griping about something. I imagine one or two are going to gripe about that,” he said. “Red Sox Nation is going to be very, very happy with what we got, I believe.”