• Turning point: Houston tied it at 1 in the second when Lee led off with a double and came around to score on throwing errors by left fielder Josh Willingham and first baseman Mike Jacobs.
• Unsung heroes: Hanley Ramirez homered and drove in three runs, and Dan Uggla also went deep. Lee Gardner (3-2) pitched one scoreless inning for the win.
• Did you see that? With two out, Stephen Randolph intentionally walked Cabrera, who then took second on a wild pitch that hit catcher Eric Munson in the throat.
-- ESPN.com news services
Marlins 6, Astros 5 (12 innings)
MIAMI (AP) -- Two wild pitches led to a crazy finish that enabled the Florida Marlins to escape with an extra-inning victory on Saturday night.
"I don't know about weird, but it was kind of lucky," Florida's Dan Uggla said.
After working a 2-1 count on Mike Jacobs, Randolph threw another wild pitch that bounced away from Munson and trickled into the Marlins dugout, allowing Cabrera to score.
Crew chief and first base umpire Randy Marsh said he and home plate umpire Hunter Wendelstedt saw Munson touch the ball before both the catcher and ball went into the dugout.
"He was the cause of the ball being out of play, so the runner gets two bases from the time of the pitch," Marsh said.
"I went to reach for the ball, and it was gone," Munson said.
Marlins manager Fredi Gonzalez had a great view of the play.
"I just saw Munson fall in," Gonzalez said. "The umpire made the right call. Munson was real close, I was standing right there."
Both wild pitches by Randolph were sliders down to Jacobs.
"Never in my life, in all my years playing baseball, have I seen a game end like that," Randolph said.
Astros manager Phil Garner said he did not regret walking Cabrera, who hit his 27th homer to tie the game at 5 in the seventh.
"We made a good pitch on him and he hit it out of the ballpark, so I wasn't about to pitch around him and have him reach out there and drive one over the wall," Garner said.
"We won -- that's all," Cabrera said. "We needed this win. If we stay like this, we can turn it around."
Jason Lane's three-run homer in the sixth gave Houston a 5-4 lead.
Ramirez hit his third leadoff homer of the season -- and 10th of his career -- in the first. It was his 18th of the season. His two-run single in the second built a 3-1 lead.
Uggla homered leading off the fifth to give Florida a 4-2 lead, his 23rd -- tops among major league second baseman.
Sergio Mitre gave up five runs, four earned, and seven hits in six innings. He walked two and struck out four.
Jason Jennings, who gave up a career-high 11 runs while recording only two outs in his last start, allowed five runs and 10 hits in 6 1/3 innings. He walked none and struck out one.
Houston tied it at 1 in the second when Lee led off with a double and came around to score on throwing errors by left fielder Josh Willingham and first baseman Jacobs.
Scott's one-out double in the fourth scored Lance Berkman to pull the Astros within 3-2. Berkman had singled and took second on Lee's ground out.
The Marlins purchased the contract of right-hander Mauro Zarate from Triple-A Albuquerque of the Pacific Coast League. ... Astros pitcher Brian Moehler entered Saturday night's game at Florida having pitched in each of Houston's previous five games. He did not make an appearance. ... Marlins left-hander Scott Olsen is the scheduled starter for Sunday's series finale against Houston. It will be his third start since being arrested and charged with DUI and resisting arrest.