It had been 20 years since the Braves lost a game to the Mets in Atlanta after leading in the ninth inning. It had been 52 appearances and nearly 11 months since Eric O’Flaherty gave up a home run.

It had been two years since two players on any team hit home runs to erase deficits in the eighth and ninth innings, and the Mets had never done it. Nor had O’Flaherty and Braves closer Craig Kimbrel ever allowed homers in the same game.

Until Friday.

The best bullpen in baseball got rocked by the Mets, who used homers off O’Flaherty in the eighth inning and Kimbrel in the ninth to erase one-run deficits and defeated the Braves 7-5 in 10 innings Friday before a stunned Turner Field crowd.

Wright launched a 97-mph Kimbrel fastball an estimated 464 feet to right-center field with one out in the ninth, and the Mets pushed across two runs in the 10th with a two-out rally against Jordan Walden and Luis Avilan to pull out a win.

“Usually you give our guys the lead, they’re going to shut it down,” said manager Fredi Gonzalez, whose relievers had a majors-best 1.94 ERA and two homers allowed before Friday. “They end up getting four runs out of our bullpen.”

The Braves’ best two relievers each got a blown save. O’Flaherty gave up a leadoff homer to Sprayberry High and Georgia Tech product Marlon Byrd in the eighth to erase a 4-3 lead, and Kimbrel coughed up the 5-4 lead on Wright’s one-out homer on a 2-2 pitch, after Kimbrel got ahead 1-2. He threw Wright all 97-98 mph fastballs.

“He’s definitely a guy you can’t make a mistake to, especially up in the zone with a fastball,” said Kimbrel, who has blown two saves in his past three appearances — half his 2012 season total — and given up as many runs (three) in his past three outings as he allowed in his previous 61 since May 5, 2012.

“Against him, it’s almost close your eyes and swing hard and hope you hit it,” said Wright, who has a career-high 29 homers in 147 games against the Braves, but was 0-for-4 with three strikeouts against Kimbrel before Friday.

The loss was the 11th in 16 games for the Braves since a 12-1 start, and the bullpen meltdown overshadowed a comeback from an 3-0 deficit and Evan Gattis’ go-ahead homer in the eighth.

The Braves had a chance to win in the ninth after a leadoff double from Ramiro Pena, but stranded runners on the corners. Jordan Schafer’s fly to center for the second out wasn’t deep enough to send Pena. After Andrelton Simmons walked, Justin Upton grounded out to end the inning.

Gattis blistered a line-drive homer to straight center for a 5-4 lead in the eighth, on the first pitch from reliever Brandon Lyon. It was the seventh homer and 17th RBI for the major league rookie leader in both categories.

The usually stoic catcher showed more emotion on his home-run trot when he rounded first and pumped his fist. Five of Gattis’ homers have put the Braves ahead, and it would’ve been his seventh game-winning RBI.

Walden had two outs in the 10th before things went sideways. He walked Jordany Valdespin on three consecutive balls after being ahead 1-2. Valdespin stole second on the first pitch to reliever Bobby Parnell, who was then replaced by pinch-hitter Mike Baxter.

Baxter swung and missed a pitch before Walden threw two balls, then hit Baxter with a 2-2 pitch that bounced off the dirt.

Walden got ahead in the count 0-2 again to Ruben Tejada, but Tejada singled on the next pitch to drive in the go-ahead run. “It’s frustrating,” Walden said. “I get him 0-2, and I hang a slider to him. I couldn’t put them away.”

Neither could Avilan. The next batter, Daniel Murphy, hit an RBI single on an 0-2 pitch off Avilan for a 7-5 lead.

Braves starter Mike Minor gave up three runs on two early homers, then retired the last 18 batters he faced after Lucas Duda’s leadoff homer in the second. He threw 90 pitches and replaced in the seventh by pinch-hitter Tyler Pastornicky, who laid down a sacrifice bunt after Pena’s leadoff single.

Pena replaced Juan Francisco, who suffered a mild ankle sprain in the third inning. After Pena advanced on a wild pitch and Schafer drew his career-high fourth walk, Pena scored to put the Braves ahead 4-3 when Simmons hit a grounder and hustled to avoid a double play.