NEW YORK (AP) -- Jonathon Niese handed a five-run lead to the New York Mets bullpen, then watched from the bench as it started to unravel.
Frank Francisco walked a pair of batters with the bases loaded and two outs in the ninth inning, then gave up a two-run double to Martin Prado that put the potential tying run on third and the go-ahead run on second.
New York was on the verge of another collapse. And when Jason Heyward swung and missed at strike three, the slider was in the dirt and rolled under catcher Rob Johnson.
Oh, oh, Mets' fans.
Only Johnson took his time, and his throw just beat Heyward for the final out.
Mets 6, Braves 5.
''That was tough. I can't sugarcoat that by any means,'' Niese said after Sunday night's goofy ending. ''But they got the job done, and that's all that matters.''
Niese pitched six-hit ball over eight innings, and David Wright sparked the offense with a pair of doubles against Ben Sheets as the Mets salvaged the finale of a three-game series.
''We needed this. We have not played well,'' Mets manager Terry Collins said. ''I am not making any excuses. We have not played well on any side of the ball. So this win helped. I don't care how it came about. I'm glad to get it.''
Rookie Josh Edgin and Francisco combined for four walks and hit a batter. The 63-year-old Collins might have put on a few years during the final three outs.
''When you need wins, they age you a lot. I make Jay's age right now,'' he said, turning to Jay Horwitz, the Mets' 66-year-old vice president of media relations. ''And if I look like it, kill me.''
A night after the Braves battered Johan Santana, Niese (9-6) matched the second-longest outing of his big league career, allowing one run, striking out six and walking two. He has alternated good and bad outings - and wins and losses - in his last four starts.
''I don't know if we're doing our job getting him prepared or not to where that last one's overlooked,'' Collins said.
Niese didn't think that was an issue.
''I don't consider it me struggling very much, but I might have had a rough game here and there,'' he said.
Edgin walked Chipper Jones on four pitches leading off the ninth, then hit Freddie Freeman with an 0-1 pitch. Dan Uggla struck out, Brian McCann flied out, and Edgin started Paul Janish off with a called strike before throwing four straight balls and loading the bases.
Pitching on consecutive days for the first time since May 22-23, Francisco fell behind pinch-hitter Juan Francisco 3-0 and threw a called strike before five straight foul balls and then ball four, forcing in a run. He got behind Michael Bourn 2-0 and walked him on five pitches, forcing in another run.
''They wore me out a little bit, and I'm a little bit out of shape,'' Francisco said.
Then Prado hit an opposite-field, two-run double to right on an 0-2 pitch. Bourn was held at third as right fielder Mike Baxter made a clean pickup.
''It would have been really hard to send him there, and you've got the middle of the order up,'' Braves manager Fredi Gonzalez explained.
Jon Rauch came in and got Heyward to swing at a slider in the dirt for strike three. Johnson blocked the ball, then carefully threw on the foul side of the line to first as Heyward approached the bag.
''The ball was underneath me when I blocked it,'' Johnson said. ''Often times when a catcher is getting up, they'll kick the ball off. That's why you have to take your time a little bit, so you don't kick the ball off.''
Rauch wouldn't give his opinion of the nerve-racking ending.
''I got nothing to say. Just doing my job,'' he said at his locker, even before a question was asked.
Sheets (4-2) had the poorest of his six outings this season, allowing five runs - four earned - and eight hits in six innings as his ERA rose from 1.41 to 2.13. He had pitched six scoreless innings in beating the Mets on July 15 in his return to the major leagues after a two-year absence.
Leading the Mets with a .325 average, Wright doubled to put New York ahead in the first and scored twice on singles by Ike Davis. Rookie Jordany Valdespin, starting in place of slumping Jason Bay, hit his eighth homer in 140 at-bats this season.
New York completed a 2-4 homestand and heads on a six-game trip to a pair of first-place teams in Cincinnati and Washington.
While the Mets won for only the ninth time in 30 games, and for just the second time in 13 home games, Atlanta lost for the just the fourth time in 18.
''I just love this team because we battled all the way to the end and we came up short,'' Prado said. ''But we tried. We played hard. That's the only thing that matters.''
NOTES: A night after Johan Santana allowed eight runs and got just four outs in his first start back from an ankle injury, Collins said the team isn't worried about the left shoulder and has no plans to end his season early. The two-time Cy Young Award winner missed 2011 following shoulder surgery. ... Torres in center field made a jumping catch at the front of the warning track on McCann's drive that ended the fourth. ... Johnson started behind the plate instead of Josh Thole for the second time in the series.