MIAMI - Carlos Ruiz had to wait an inning to launch the game-winner.

At the plate with one out in the ninth inning of a tie game, the catcher watched the Phillies' shot at winning in regulation end with two straight outs on the basepaths.

But when he finally got a chance to swing, he made it count, leading off the 10th inning with a solo home run to leftfield that lifted the Phillies to a 5-4 win that capped a series sweep over the Marlins.

It was a whacky game, to say the least, one that featured blown leads by both teams, a controversial fair-or-foul call, and a save by closer Brad Lidge.

And the end of it all, the Phillies emerged with their 12th win in 14 games, keeping pace with the Braves, who remain two games ahead of them in the National League East. At 60-48, they are a season-beat 12 games over .500.

"I feel good," said Ruiz, who went 3-for-5 with three RBI, recording multiple hits for the sixth time in nine games in raising his average to .298. "I feel relaxed. I feel like I'm using more of my hands right now. Since I'm thinking to hit the ball in the middle of the field, I can see the breaking balls better, and that's the way I'm working right now everyday."

The pitch he hit was a slider from lefty Will Ohman, and it capped off a game with no shortage of wild moments.

The Phillies took a 2-0 lead in the sixth inning on a two-run double by Ruiz, putting righthander Roy Oswalt in position to earn his first victory with his new team. Oswalt, acquired last Thursday in a trade with the Astros, held the Marlins scoreless for the first six innings, allowing just two hits and three walks while striking out five. But with Oswalt at 109 pitches and men on first and second and one out in the seventh, Phils manager Charlie Manuel called on lefty J.C. Romero to face lefty pinch-hitter Chad Tracy.

"I understand the situation," said Oswalt, who added that he has been battling a case of dead arm that usually strikes him this time of year. "I had 100-something pitches and it was pretty warm out there today. I kind of battled through some innings early and I really didn't find my mechanics until late in the game."

But after the Marlins countered with pinch-hitter Donnie Murphy, things spun out of control. Murphy hit an RBI double that cut the lead to 2-1, and Romero walked the next two batters to force the tying run home.

Jose Contreras came on to work out of the jam, but not before allowing a base hit to Gaby Sanchez that gave the Marlins a 4-2 lead.

"[Oswalt] had some long innings, and he'd thrown 109 or 110 pitches," Manuel said. "I wanted to put Romero on Tracy. That's kind of how I looked at it, and it didn't work out . . . I could tell he wanted to stay. He didn't have to say nothing."

Still, the zaniness was only starting. Trailing by two runs and down to their final three outs, the Phillies put their first four batters on base in the ninth. Placido Polanco reached on a Hanley Ramirez throwing error, Ross Gload singled, Raul Ibanez banged an RBI double off the leftfield wall and Jayson Werth hit an RBI single through a drawn-in infield that tied the game, 4-4.

With no out and men on first and third, the Phillies were in prime position to take the lead.

But Ibanez was tagged out in a rundown that began with a weak groundball by Domonic Brown. Then, with Ruiz at the plate, Werth was picked off second before one pitch, and then Brown was thrown out trying to steal second.

The Marlins would have won the game in the bottom of the ninth on a Gaby Sanchez double down the leftfield line - Ramirez sprinting hard from second - but third-base ump Bob Davidson ruled the play foul. Replays showed the ball landing in fair territory beyond third base, but the ball also appeared to be traveling in or close to foul territory after bouncing twice before the bag.

Regardless, Ryan Madson worked out of the jam to preserve the tie, and Lidge followed Ruiz' home run with his 12th save. Lidge, who had blown four of his previous 11 opportunities, allowed a leadoff single to Mike Stanton but struck out Wes Helms and Brett Hayes before getting Emilio Bonifacio to fly out to right to end the game.

Oswalt got a no-decision. Madson, who struck out three of the four batters he faced, improved to 4-1.

"Getting to know the guys and being around them for 5 days now has been a lot better than the first day, not really knowing what to expect," Oswalt said.

That said, nobody could have expected last night's ending.

For more Phillies coverage and opinion, read David Murphy's blog, High Cheese, at http://go.philly.com/highcheese. Follow him on Twitter at