DETROIT -- Carlos Corporan and J.D. Martinez drove in five of the Astros runs. But it was almost an afterthought by the time Miguel Cabrera's deep bases-loaded fly ball fell into Brandon Barnes' glove to end the game Wednesday.
Following a go-ahead RBI double by Corporan in the top of the ninth inning, closer Jose Veras loaded the bases with two outs for the reigning American League Most Valuable Player and Triple Crown winner.
Cabrera took a 95-mph fastball to the opposite field -- a shot that seemed to hang for minutes -- as Barnes drifted back to the out-of-town scoreboard in right-center field -- the deepest part of the park -- and jumped up against the wall to secure it for a 7-5 victory over the Tigers at Comerica Park.
"They say it's a game of inches," Astros manager Bo Porter said. "The inches fell our way today."
It might've been six inches from clearing the fence for a grand slam and leaving the Astros winless in their past seven games. But fortunately for Houston, it escaped Detroit before any more harm could be done.
It didn't appear to be heading that way, however. Twice, the Astros surrendered slim leads before regaining it for good on Corporan's two-bagger and a sacrifice fly by Matt Dominguez in the ninth.
After Veras walked Brayan Pena and Omar Infante and hit Torii Hunter with a pitch to bring up the league's best hitter, the Astros appeared all but set to suffer another heartbreaking loss.
"You see him walking up there," Porter said, "and you're saying to yourself, 'Oh boy, this is [not] the type of situation to be in.'"
Cabrera is leading the Majors in average with runners in scoring position (.490) and runners in scoring position with two outs (.600).
Even Barnes, standing in center, could feel something brewing.
"As soon as Miggy came up, I felt the wind start to push and change a little bit," Barnes said. "It was weird, because as soon as he came up, the wind just started blowing out."
It wasn't blowing hard enough. Not for a home run in Detroit.
"In this park?" said Cabrera as he burst out laughing.
The win snapped a six-game slide and awarded the Astros a happy flight to Pittsburgh for a three-game series beginning Friday.
Of course, it wouldn't have been possible without a sudden offensive outburst by Houston against Detroit right-hander Max Scherzer. In the previous two games, the Astros took early leads, but each time out, they quickly surrendered them.
The same held true Wednesday, when a solo shot by Corporan off Scherzer in the second inning -- his third of the season and the first of two off the Tigers starter -- was quickly erased in the bottom half of the frame. It was the first time that Scherzer allowed multiple homers in a game this season.
Dallas Keuchel, making his second start, yielded back-to-back singles before No. 9 hitter Avisail Garcia launched a 2-0 changeup to left for the first home run of his career, a three-run shot to give Detroit a 4-1 lead.
But unlike the previous two games, Houston responded with its own rally on Martinez's three-run, first-pitch homer to the brick wall in left-center field, nearly hitting Willie Horton's No. 23. It followed a Carlos Pena RBI single to help the Astros go up by one.
"That was big," Keuchel said. "It's evident right now he's back on track to where he was when he first came up. He got a hanging slider, and he put a hit on it."
Said Porter: "The group we have is resilient. They fight, they claw, they battle and just a tremendous team effort today against a really good ballclub."
An error by Marwin Gonzalez on Victor Martinez's grounder kept the Tigers' sixth inning alive. Like one would expect the reigning AL champs to do, they capitalized on the miscue with back-to-back singles to tally another game-tying run.
The score remained deadlock at 5 until Coporan's gapper plated Barnes, who pinch-ran for Martinez after a leadoff walk.
"When you're a backup, you know when you're going to play, so I kind of prepared myself for this," Barnes said. "And when you prepare, good things can happen."
That's a message Porter's stressed throughout the early months of the 2013 campaign. He's also harped on effort, and he wore his uniform proud for what his team gave Wednesday.
"You see the type of effort out there today, it lets you know that they get it," he said. "They understand."
Anthony Odoardi is a contributor to MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.