Phillies starter Cole Hamels had blown a three-run lead in each of his last two starts, but was staked to a six-run advantage before he even took the mound Wednesday.

Hamels, though, wobbled through six-plus innings and the Twins made a late charge, but Philadelphia hung on for a 9-8 win over Minnesota in the middle installment of a three-game interleague series.

Former Twin Jim Thome registered four RBI, including a mammoth two-run shot, while John Mayberry belted a three-run homer as part of the six-run top of the first for the Phillies, who won for just the second time in their last 11 games.

"Baseball is an up-and-down game," Thome said of the Phillies' recent bad play. "Anytime you get a w, you want to stretch that out and that's where we're at. We're not trying to look too much ahead."

Hamels (9-3) fanned six and surrendered seven runs -- six earned -- on eight hits. The All-Star left-hander has accumulated a 6.75 ERA over his first three starts in June.

Josh Willingham laced a solo shot among his two RBI to extend his hitting streak to 15 games for Minnesota, which has lost three of its last four. The red-hot Trevor Plouffe, who's hitting .400 this month with six homers, 13 RBI and 11 runs scored, smacked a solo shot.

"We do not die whatsoever no matter how many runs we're down. That's what Twins baseball is all about," Twins outfielder Ben Revere said.

P.J. Walters (2-2) allowed four consecutive singles to start the game before exiting with right shoulder stiffness. He was charged with four runs.

The Phillies led 9-3 following Thome's moonshot to center in the fourth inning.

He cracked a 2-1 changeup from Anthony Swarzak that sailed over the batter's eye in center field and onto the main concourse. The blast was estimated at 466 feet and Thome received a standing ovation while circling around the bases.

Minnesota, however, stormed back into the contest with a run in the sixth and four more in the seventh.

Willingham cracked a solo shot in the sixth to cut the deficit to 9-4, while Denard Span's RBI double -- which knocked Hamels out of the game -- and a pair of RBI singles by Ben Revere and Joe Mauer trimmed the margin to 9-7.

With runners on second and third with none away, Antonio Bastardo struck out Willingham before Morneau made it a one-run game with an RBI groundout.

Chad Qualls fanned three -- although the final strikeout victim, Jamey Carroll, reached base on a wild pitch -- in the eighth, before Jonathan Papelbon came on for a four-out save, his 17th of the year.

Earlier, four consecutive singles to start the game by Jimmy Rollins, Juan Pierre, Hunter Pence and Thome gave the Phillies a quick 2-0 lead. With the bases loaded, Thome ripped a base hit to right-center, which plated Rollins and Pierre.

Jeff Manship entered the game for Walters and Carlos Ruiz greeted him with an RBI single to right. Two batters later, Mayberry laced a three-run homer over the wall in left.

Plouffe drilled a solo shot over the wall in left to get the Twins on the board in the second, but the Phillies got the run back in the third when Mayberry pulled an RBI double down the third-base line to make it 7-1.

Game Notes

Hamels moved to 5-0 on the season in six outings away from home and avoided dropping a third-straight start for the first time since Aug. 7-19, 2010... Pierre, Pence and Ruiz added three hits apiece, with Pence and Ruiz scoring twice.