Doug Slaten (0-2) got the first two outs of the inning with ease, as he struck out Logan Morrison and got John Buck to fly out to deep center, but he left a fastball up and over the plate to Petersen, who deposited it seven rows deep in right field for the walkoff winner.
Javier Vazquez (13-11) was brilliant on the mound. He pitched a complete game five-hitter while striking out nine without issuing a walk. The veteran right- hander won his last six starts.
Vazquez struggled in his first 14 starts of the season, going just 3-7 while holding the highest ERA among qualifying starting pitchers at 6.85. But he turned it around in his final 18 starts, going 10-4 to close out the season. The Marlins went 7-0 in his final seven outings.
"He's a great pitcher," Nationals manager Davey Johnson said. "He didn't give us very much to hit. It was a great effort."
Emilio Bonifacio had two hits, an RBI and a run scored for the Marlins, who snapped a four-game skid.
The Marlins opened the scoring in the third inning when Matt Dominguez led off the frame with a double to deep center, moved to third on a sacrifice bunt by Vazquez and trotted home on a sacrifice fly to center by Bonifacio.
The Nats came back to tie it in the fifth courtesy of the blast by Morse, his team-leading 31st home run of the season.
Steve Lombardozzi started the Nationals sixth with a double into left, moved to third on a perfectly-placed sacrifice bunt by Nationals starter John Lannan and came home on sharp single down the right field line by Desmond for a 2-1 Nats lead.
Florida tied the game in the home half of the frame when Bonifacio doubled into the left field corner to start the frame, then stole third without a throw before coming home on a wild pitch by Lannan.
Bonifacio singled to start the Marlins' eighth, moved to second on a sacrifice bunt by Omar Infante and to third on a groundout by Mike Stanton. The Marlins were unable to take the lead however, as Todd Coffey fanned Gaby Sanchez to end the inning.
"It was great to see Javier go out on such a good note," Marlins manager Jack McKeon said. "He's been such an important part of our ball club this last half of the season. He's an outstanding pitcher and a real professional."
During the game, the Marlins announced they signed Infante to a two-year contract extension through the 2013 season...Bonifacio extended his hitting streak to nine games...Heavy rain began falling in the top of the sixth inning...Morse has more home runs this year than in his previous six seasons (21) combined...Lannan gave up two runs on three hits over six innings while fanning four and walking three.