Vazquez, who's leaning toward retirement, had gone nine innings and was preparing to pitch another Tuesday night when Petersen homered with two outs in the bottom of the ninth to give the Florida Marlins a 3-2 victory over the Washington Nationals.
Vazquez's franchise-record scoreless streak ended at 29 innings, but he finished with a five-hitter. The right-hander needed just 97 pitches in his 28th career complete game, and second this month.
Petersen joked that he would give his home run ball to Vazquez.
"Any home run I hit is cool for me," Petersen said. "But it's way more special for me to know that I could be a part of that for him. Hopefully that game sticks with him for the rest of his life if it's his last one. An unbelievable pitching performance, and to end it like that? I'm happy for him."
The 35-year-old Vazquez (13-11) allowed only three runs over his final six starts and won them all. He said the strong finish won't influence his decision about retirement, because he wants to spend more time with his wife and three children.
"I've been blessed being in the big leagues for 14 years. I feel it's time," he said. "I'm going to make the decision, hopefully by December."
Vazquez had the highest ERA in the majors at 7.09 in mid-June, then pitched well enough to lower his final figure to 3.77.
"It's fun to go out there and pitch good," he said. "But it's not easy. The way things started for me the first two months, I couldn't say I was going to finish like this."
The game was played with both teams counting down to the offseason, and the Marlins expected to announce the hiring of Ozzie Guillen as manager.
Wednesday's game will be the season finale and the last in the stadium that has been the Marlins' home since their first season in 1993. Next year they move into a retractable-roof ballpark in downtown Miami.
Doug Slaten (0-2) retired the first two batters in the ninth before Petersen homered on the first pitch. That was only the fifth hit for Florida.
The walkoff homer was the third for the Marlins this season.
Washington starter John Lannan went six innings and gave up two runs. The loss ended the Nationals' bid for the franchise's first winning season since 2003. They are 79-81 with one game left.
"We went up against a great pitcher who pitched a heck of a ballgame," manager Davey Johnson said.
Michael Morse hit his 31st homer leading off the fifth to end Vazquez's scoreless streak. Morse will likely sit out Wednesday, leaving his final average at .303.
"I feel like I've achieved a lot," he said. "I've put in a lot of hard work and am glad to see it paid off."
Florida tied game at 2 in the sixth when Emilio Bonifacio doubled, stole his 40th base of the season and scored on a wild pitch by Lannan.
The Marlins took a 1-0 lead in the third when Matt Dominguez led off with a double, advanced to third on a sacrifice bunt by Vazquez and scored on a sacrifice fly by Bonifacio.
Washington scored in the sixth on Ian Desmond's RBI single.
Nationals 3B Ryan Zimmerman sat out with a sore hamstring, and it's unlikely he will play Wednesday. ... Nationals RHP Stephen Strasburg makes the fifth start of his comeback from elbow surgery Wednesday. He's 0-1 with an ERA of 2.00 in 18 innings. ... RHP Chris Volstad, who will start for Florida, has an ERA of 2.65 in his past six starts.