It was a costly outing for Mets reliever Justin Wilson on Sunday night.

In a must-win series finale against the Dodgers, Wilson couldn’t follow up a strong seven-inning performance from starter Zack Wheeler as the Mets fell 3-2 at Citi Field.

When Wilson entered with a 2-1 lead in the eighth inning, things didn’t look promising from the start. He gave up a leadoff walk to pinch-hitter Jedd Gyorko and then a series of unfortunate events of Wilson’s own making during Max Muncy’s at-bat helped the Dodgers tie the game.

Wilson balked and threw a wild pitch to allow Gyorko to go from first to third before striking Muncy out. He then gave up a game-tying double to Chris Taylor. After intentionally walking Cody Bellinger to put runners on first and second, Wilson struck out Corey Seager.

Seth Lugo, who eventually earned the loss, was promptly called from the bullpen to relieve Wilson for the night. A fly out from Dodgers catcher Will Smith ended to the inning.

“I just caught my cleat on the balk. I guess I could’ve thrown it, but I don’t really know how that would’ve ended up,” Wilson said after the loss. “But, yeah, just caught my cleat, nothing I can really do about it. Wild pitch, cutter that kind of slipped out of my hand.

“Anytime the leadoff guy gets on late in the game it hurts, would’ve liked to not walk him and make him earn his way on, of course. But I think with the double, wild pitch and balk I think he’s scoring regardless. But you’ve got to keep them off base.”

The 32-year-old lefty has been one of the Mets’ best relievers this season, giving up just nine earned runs in 35 innings before Sunday night. Wilson hadn’t given up a run since a loss to the Phillies on Sept. 8.

“We’ve got to win, we’ve had to win for a month really,” Wilson said. “It is what it is, we’ve got to win [Monday] now. This team hasn’t given up once this whole season. Zack pitched amazing tonight. Sadly, you know, I couldn’t hold the lead for him. Wanted to finish the eighth to keep Seth out of it for just a one-inning ninth but the team is resilient and we’ll back at it [Monday].”

Purchase event tickets to The Amazin’ 1969 New York Mets: A World Championship for the Ages presented by The Paley Center for Media and New York Post. Enter promo code: NYPOST to unlock tickets only available for Post readers.