Zack Wheeler’s possible farewell performance for the Mets lasted one inning too long, but it was hardly a catastrophe.

After firing seven shutout innings and delivering a go-ahead RBI single Thursday night, Wheeler returned to pitch the eighth and finally caved to the Marlins.

Curtis Granderson’s tie-breaking homer became the dagger in the Mets’ 4-2 loss at Citi Field, on their first night of meaningless September baseball. The Mets were eliminated from postseason contention on Wednesday night.

“I love New York and I love the Mets,” said Wheeler, who is headed to free agency after the season. “They treated me fairly and very good. I just wanted to give everything back that I could.”

Wheeler said his biggest disappointment was missing 2015 and 2016 rehabbing from Tommy John surgery. The Mets won the NL pennant in ’15 and reached the wild-card game in ’16.

“This season, we didn’t get where we wanted, but we finished with a winning record, so that was nice to be a part of,” he said. “I wish we could have done a little bit more.”

In a scoreless deadlock, Wheeler was allowed to hit with the bases loaded in the seventh and drove in the game’s first run with an RBI single. Brandon Nimmo’s sacrifice fly moments later provided a cushion.

But Wheeler was roughed up in the eighth, allowing a two-run homer by Tyler Heineman to tie it 2-2 before Granderson, pinch-hitting, cleared the fence in right-center.

Wheeler, who is expected to at least receive a qualifying offer worth roughly $18 million from the Mets for next season, finished with a 3.96 ERA over a career-high 195 ¹/₃ innings.

“This kid, what a great second half,” manager Mickey Callaway said, referring to Wheeler’s 2.83 ERA after the All-Star break. “Another eight innings tonight, he deserves to go explore what can happen for him, that is pretty awesome.

“I wanted him to get that complete-game shutout and go into free agency on the highest note he possibly could.”

Edwin Diaz received an earful of jeers after surrendering a solo homer to Austin Dean in the ninth that gave the Marlins their final run.

The blast was the 15th allowed by Diaz in 57 innings this season.

“Just a hanging slider and they make him pay,” Callaway said. “This is incredible. It’s one bad pitch and they make him pay, not with a base hit, but with a homer. It’s crazy. I have never seen anything like it.”