Nobody said battles at the bottom can't be entertaining.

Ryan Jeffers broke up Tarik Skubal's perfect game in the fifth inning with a home run on Thursday, Miguel Sano tied the game with a 411-footer of his own, and the Twins bunted, blasted and hustled their way out of last place in the AL Central with a 5-3 victory over Detroit at Target Field.

"It was a lot of fun," said reliever Tyler Duffey, whose role in it lasted 15 pitches and three quick outs. "We kind of slammed the door on them."

The Tigers had won six of their past eight games to climb into third place, and the Twins had lost seven of their past nine to fall into last, but the teams certainly looked well-matched as they opened a rare stretch of eight consecutive games against each other. Detroit outhit the Twins, but kept leaving runners on base. The Twins managed only six hits, two apiece in the fifth, sixth and seventh innings — but scored in each of them.

"Everywhere you look, there are positive things to say," Twins manager Rocco Baldelli gushed. "A good ballgame when you stay at it like that and you're able to come back and get a nice win. It does feel good."

J.A. Happ probably felt best of all after turning in seven strong innings, his longest start since April. Happ, 5-4 despite a 5.90 ERA, gave up a 408-foot, two-run homer to Eric Haase and walked in another run, but otherwise escaped the trouble that has so often bedeviled him this season.

"Almost halfway through [the season] and we've finally found a rhythm. It's better now than ever," Jeffers said of catching a teammate almost 15 years older. "When J.A.'s in a rhythm, when he's getting the ball, picking out the target and going, he's a really good pitcher. He gave up six, seven hits [actually eight] this, but maybe the home run was the only ball that was really hit hard."

BOXSCORE: Twins 5, Detroit 3

Meanwhile, the Twins were making the game exciting for the 18,182 in the stands in a lot of unusual ways. Jorge Polanco beat out a bunt single, his — and the Twins' — third of the season. Andrelton Simmons executed a sacrifice bunt that ended up being important in the go-ahead rally. And the middle infielders executed a spectacular double play in the sixth — Polanco dove to spear a hard-hit grounder in front of second base, flipped the ball from the dirt to Simmons, who threw flat-footed to first — to allow Happ to escape Detroit's bases-loaded threat.

"[Polanco made] the kind of play that Simba makes all the time. I bet it's fun playing up the middle with him," Baldelli said. "And when Polo is the one making the play, I'm sure he gets a little satisfaction out of it."

The Twins got a lot of small satisfactions in this one, even the Twins' newest All-Star and oldest player. In the sixth, after Polanco's bunt single and a walk to Josh Donaldson, Nelson Cruz hit what appeared to be an inning-ending double play. But Cruz moved his 41-year-old legs so quickly down the line, he beat Willi Castro's relay to extend the inning. Moments later, Trevor Larnach singled Polanco home, a run for which Larnach will get the RBI but Cruz deserves much of the credit.

"Those are the things we talk about," Baldelli said. "Not every one of those instances or plays are things you actually, physically work on. A lot of those are mental moves and adjustments and discussions. We saw a lot of good today."

Especially in the standings. The Twins hoped they had escaped last place for good in late June, and even talked bravely about turning around their season. A 1-5 road trip and some humbling losses to the White Sox jolted them back into their lost-season reality, and back into the cellar. But Thursday's win dropped Kansas City behind them again, and they've got nothing but Tigers on the schedule for the next 10 days.

"These games count, too," Donaldson said. "Might as well win them."