HOUSTON – The Twins enjoy playing the Astros so much, they never want it to end.

Or so it seemed Tuesday night, when Minnesota squandered a three-run lead with two outs and nobody on in the ninth inning, then restored order with a three-run uprising three innings later. Glen Perkins suffered his fourth blown save of the season, but no harm done: Minnesota stayed unbeaten against the game-but-mistake-prone Astros with a 9-6 victory in 12 innings.

A wild pitch by Astros reliever Kevin Chapman scored Clete Thomas with the go-ahead run in the 12th, and Darin Mastroianni doubled home two more to improve the Twins to 5-0 against Houston this season, and ensure another winning road trip. The Twins, 4-1 on this march through Texas, have finished with a .500-or-better record in all five trips since the All-Star break.

"We come out of it with a win, that's the important thing," manager Ron Gardenhire said. "We haven't lost a lead too many times with Perk in the game. He just didn't have his stuff."

This victory was more difficult than it needed to be, especially considering the Twins hammered out 16 hits, including home runs by Brian Dozier and Trevor Plouffe, the second in two nights for both. Dozier tied now-departed Justin Morneau for the team lead with his 17th home run, while Plouffe's homer was the first blow in a career-high four-hit night.

Perkins seemed truly stunned by Houston's lightning strike that broke his streak of eight consecutive saves converted, staring blankly at the right-field foul pole after Brandon Barnes lined an 0-2 fastball about 10 feet inside of it, only the fifth home run he has allowed all year.

But it wasn't the home run that truly bothered him, he said.

"It's [Brett] Wallace. Two outs, nobody on, 0-1 count, and I hit him with a fastball. He's the guy I need to get out, and I didn't, and it snowballed from there," said Perkins, who at one point was one strike away from his 33rd save.

The Twins closer was far from sharp, giving up a leadoff line drive to Trevor Crowe, but got two outs on a double-play grounder.

Then he hit Wallace with a pitch. Then L.J. Hoes grounded a single to right, and suddenly Perkins was facing the potential tying run at the plate.

No problem, right? Barnes is a defensive-minded center fielder with only six home runs this year, none since Aug. 9. Perkins quickly blew a couple of 96-mph four-seamers by him, with Barnes swinging at both and managing to nick one of them foul.

A third fastball was one too many, though. Barnes smashed it about 350 feet, but it was enough to carry into the seats and tie the score.

Once the Twins scored three in the 12th off Chapman, with Josmil Pinto — who had four hits and a walk in only his second major-league game — and Mastroianni collecting critical doubles, the Twins left it to Josh Roenicke to save the game. He put a pair of runners on, but escaped with his first save as a Twin, and only the second of his career.

Houston's ninth-inning dramatics, performed in front of a smattering of perhaps 5,000 Astros fans in Minute Maid Park, erased what would have been Pedro Hernandez's fourth victory of the year. Despite pitching only 18 innings since the All-Star break (at Class AAA Rochester and at the rookie level while rehabbing from a shoulder problem), the Venezuelan lefthander ripped through the Astros lineup with little trouble, needing only 70 pitches to complete six innings and hand over a 4-1 lead to the bullpen.