They had to feel lucky, thanks to Ruiz, on the late-night charter flight back to Philadelphia.
"I feel good," Ruiz said. "I feel relaxed at the plate. I feel like I'm using more of my hands. I'm hitting the ball in the middle of the field and seeing the breaking balls right now."
Ruiz is hitting .298 this season. He was 3 for 5 with two doubles, the home run and three RBIs Thursday.
"He has a quick swing," manager Charlie Manuel said. "It's the best I've seen him hit since he's been in the big leagues. That right there is what we need, people to step up. He's definitely been doing that."
In the later innings, the Phillies made numerous mistakes but still won. Begin with Manuel's decision to pull his new ace, Roy Oswalt, after 109 pitches and with one out in the seventh inning. He called upon lefthander J.C. Romero, who allowed a run to score on a ground-rule double, intentionally walked Hanley Ramirez to load the bases, and then walked Logan Morrison to force in the tying run.
Jose Contreras was next in the bullpen, and he allowed a go-ahead, two-run single by Gaby Sanchez.
Manuel said he weighed Oswalt's pitch count and the fact that a lefty was coming up to hit. Oswalt said he was going through a normal "dead arm" period.
"He had a high pitch count early and had some long innings," Manuel said of Oswalt.
But that mattered little when the Phillies rallied in the ninth. After tying the game, they had runners on first and third with no one out and a great chance to take the lead.
The Phils made the next three outs on the base paths.
Raul Ibanez broke home when Domonic Brown hit a grounder to first. He was caught in a rundown between third and home plate. Then, with Ruiz at the plate, Jayson Werth was inexplicably caught too far off second by Marlins closer Leo Nunez, who picked him off. Finally, Brown was caught stealing to end the inning.
In the bottom of the ninth, the Marlins appeared to have the game won when Sanchez smoked a liner over third base. But third-base umpire Bob Davidson ruled the ball foul, although replays showed it was in fair territory over the bag and hit the dirt in fair territory just past the base. Sanchez struck out and the Marlins didn't score.
In the seventh, when Manuel came to yank Oswalt, the pitcher acquiesced, despite working on a shutout. But as soon as he reached the visitors' dugout, Oswalt took off his hat and slammed it on the wooden bench.
Rarely did he have a lead pitching for Houston this season. Oswalt had the worst run support in the majors while posting a stellar 3.42 ERA marred by a 6-12 record.
But now the Phillies had given him two runs, and in a pennant race for the first time in years, Oswalt wanted to finish the seventh. Manuel didn't let him.
Plenty of mistakes later, the Phillies still emerged winners. Just like Manuel drew it up.
"Not quite," he said, with a smirk.
Contact staff writer Matt Gelb
Follow on Twitter