Somehow, the Mets nearly survived every calamity they encountered Tuesday night, from Jay Bruce’s brutal rendezvous with rock bottom to Terry Collins’ curious bullpen management. But when a late rally fell short, and the Braves escaped from Citi Field with a 5-4 victory, the Mets faced bitter consequences.

The defeat invited more chaos in the mad scramble for the National League’s two wild cards. The Mets (80-71), Cardinals and Giants are tied with 11 games to play.

“We knew we were going to be in a dogfight,” said Collins, who lifted the struggling Bruce for a pinch hitter as the Mets rallied for three runs after trailing 5-1 to start the eighth.

Curtis Granderson doubled in a run and T.J. Rivera followed with a sacrifice fly, bringing up Bruce as the potential tying run. But with lefty Ian Kroll in the game, Collins pulled Bruce, a stunning but logical move that amplified just how badly the run producer has flopped since arriving at the trade deadline.

“It’s one of the worst things you can do for a manager, pinch hit for a star,” Collins said.

Still, the tactic worked. Eric Campbell, a lifetime .221 hitter who has spent much of the season with Triple-A Las Vegas, rocketed a run-scoring single.

advertisement | advertise on newsday

“I definitely didn’t draw it up like this,” said Bruce, who is mired in an 0-for-13 slump that has dropped his average since joining the Mets to .176.

Down just one run, pinch hitter Kevin Plawecki bounced a routine grounder past third baseman Adonis Garcia, sending a wave of hope through the crowd. But Travis d’Arnaud hit a weak grounder to end the rally.

With Asdrubal Cabrera on first in the ninth, Braves closer Jim Johnson struck out Yoenis Cespedes for the final out, though by then the Mets had done plenty to hurt their chances.

After the Mets took a 1-0 lead in the third, the tying run scored on a fly ball that could have been caught. The go-ahead run scored on a bases-loaded walk. The three-run homer that shaped the outcome came when a lefty specialist was permitted to face a righty.

Julio Teheran (6-10) continued his dominance over the Mets, allowing one run in seven innings. He is 2-0 with a 0.90 ERA against the Mets after retiring 15 of the final 16 batters he faced.

Mets videos

The Mets coughed up the lead in the sixth through a series of misadventures. With one out, Ender Inciarte singled and Garcia followed with another, bringing up the dangerous Freddie Freeman. But Collins didn’t have a lefty ready in the bullpen, leaving starter Robert Gsellman in to issue a walk.

With the bases loaded, Matt Kemp lifted a fly ball to right-center that appeared catchable. But the ball dropped between Bruce and centerfielder Curtis Granderson. “I didn’t call it,” Granderson said, noting that it was his responsibility to do so.

Said Bruce: “No communication.”

Inciarte scored the tying run. And with the bases still loaded, lefthander Josh Smoker walked Nick Markakis, forcing Garcia across as the go-ahead run.

In the seventh, with lefty specialist Jerry Blevins left in the game, the righthanded-hitting Garcia bashed a three-run shot that opened up a four-run cushion that proved insurmountable.

advertisement | advertise on newsday

The Mets fell to 9-9 against the Braves, missing an opportunity to do damage against one of baseball’s worst teams. It has cost them dearly, part of the reason that their quest for a wild- card spot has become tricky. Now, the Mets need Bartolo Colon on Wednesday night to help avoid a three-game series sweep against the Braves.

As the homestretch looms, the race has only tightened.

Said Collins: “It’s going to be down to the wire.”