Kevin Gregg escaped a bases-loaded jam when Jimmy Rollins flied out on a 3-2 pitch to end the game, and Florida beat Philadelphia 7-6.
The Phillies blew a 5-0 lead to lose their second game in a row after winning six straight. They fell four games behind the first-place New York Mets in the NL East.
"We needed this one," Rollins said. "We jump out there and get a five-spot -- there's no way that should be given up."
Cody Ross drove in three runs with two homers to lead the comeback by the last-place Marlins. They've won two games in a row for the first time since Aug. 10-11.
"The last few weeks, it seems like we've been down 5-0 or 6-0 in the first few innings every game," Ross said. "To keep the fight, especially against the Phillies when they're needing victories as bad as anybody, it's a big win for us."
Miguel Cabrera hit his 31st homer, and Hanley Ramirez and Dan Uggla hit back-to-back homers in the seventh to give Florida a two-run lead.
"Five home runs, and they were good ones," Phillies manager Charlie Manuel said. "There were no cheapies."
Dontrelle Willis scored Florida's other run after hitting a pinch-hit double to start the fifth. Five relievers, including Justin Miller (5-0), limited Philadelphia to one run in the last 5 2/3 innings.
Gregg earned his 28th save in 30 chances but needed 43 pitches to get four outs.
With the score 7-5, Gregg came on to retire Pat Burrell on a popup with runners on second and third to end the eighth. The Phillies scored in the ninth on a two-out RBI single by Carlos Ruiz, and Chase Utley walked to load the bases.
Rollins took strikes on 2-0 and 3-1 pitches, and the Phillies disputed both calls by umpire Rob Drake.
"It seems like we'd get some of those," Manuel said. "That ain't the first time. What are you going to say?"
Rollins then flied out to center field.
Asked how he would describe the ninth inning, Gregg said: "Long."
"I'm never going to give in," he said. "I'm going to make them hit my pitch. Sometimes it's going to take you a couple of more pitches to get through an inning like that."
The Marlins scored seven times before they made an out in Saturday's win, but the offense took awhile to get going Sunday. Pitcher Adam Eaton's first homer since 2003 put the Phils ahead 5-0 in the fourth.
"Given a five-run lead, it's real frustrating not to hold down the fort," Eaton said.
Ross hit his 10th homer -- and his third in four at-bats over two games -- for a 5-all tie in the sixth. He was in the lineup only because left fielder Josh Willingham is nursing a stiff back.
Ramirez broke the tie with his 24th homer on the second pitch from Kane Davis (0-1), pitching in his second big league game since 2005. Uggla then hit his 28th homer, surpassing his total as a rookie last year.
Florida's other five-homer game was Sept. 11, 2006, against the Mets. The Marlins need only eight more home runs to break the team record of 182 set last year.
Eaton, bidding for his first win since July 20, allowed five runs and three homers in six innings. Florida starter Scott Olsen lasted only 3 1/3 innings and allowed five runs.
The Phillies scored four times in the third inning, when Olsen needed 45 pitches to get three outs. Rollins led off with a triple, and after Burrell walked, Olsen gave up three consecutive hits. Ryan Howard singled home one run, Aaron Rowand doubled home another and Jayson Werth hit a two-run double.
The rally stirred chants of "Let's go Phillies!" from the crowd of 12,334. But the cheers were all for the Marlins once their homer binge began.
"By the end of the game," Ross said, "I was hearing a lot of 'Let's go Marlins.'"
OF Chris Roberson was recalled by the Phillies from Triple-A Ottawa and pinch-ran in the ninth. ... 2B Utley, who is 2-for-18 against Olsen, was held out of the starting lineup but came off the bench in the eighth. ... Cabrera improved to 12-for-15 with three homers against Eaton.