See more of the story

Fernando Rodney blew his first save with the Twins. It seems only fair to credit Max Kepler with one, though.

The Twins built a seven-run lead Wednesday, then gave it all back, Houston’s tying run scoring on a wayward Brian Dozier relay throw that could have been the final out. But just when a faith-shaking loss appeared inevitable, Kepler stepped up and socked a full-count slider from Brad Peacock into the right-field seats, rescuing his team with his second home run of the game for a 9-8 victory over the Astros at Target Field.

“I was battling. Battle mode. Just trying to put the ball in play,” Kepler said of his second career walkoff blast. “It was right over the middle, kind of low. I like them low.”

Maybe so, but he rockets them high, just as he did to the Twins’ sagging spirits. “It’s big. They’re really good over there,” Dozier said of the defending World Series champions. “We let a big lead slip away, but Kepler saved us.”

The game could have been a confidence-building blowout, as the Twins combined five hits with three walks against Lance McCullers Jr. in the fourth inning, an eight-run eruption that had three of the most frustrated hitters at its core. Eddie Rosario, Logan Morrison and Kepler, who had stranded a combined total of 29 runners on second or third base by going 2-for-21 with runners in scoring position this season, all came through with run-scoring hits.

Rosario smacked a bases-loaded triple to the wall in right-center, bringing home three runs. Morrison followed with a ringing RBI single.

And two batters later, Kepler blasted a home run just inside the right-field foul pole, putting the Twins up 8-1.

In most cases, an eight-run inning might make for a relaxed, cruise-control afternoon, especially with a pitcher who has not lost since early August on the mound. But not so with the Astros, who had not lost a series to the Twins since 2015. As Houston chipped at the lead, it became difficult to tell which team was winning, Twins manager Paul Molitor said.

“[We’re] coming off the field [after the sixth inning, ahead 8-6] and it didn’t feel like we’re still winning,” Molitor said. “I walked up and down [the dugout] and said, ‘We are winning this game.’ ”

But that didn’t last. While five Houston relievers embarked on a string of 14 consecutive batters retired, Twins pitchers put runners on base all nine innings. And Rodney got into trouble right away, giving up a leadoff single to Evan Gattis. After a strikeout, J.D. Davis singled, and a 3-2 fastball to Marwin Gonzalez missed, loading the bases.

George Springer appeared to bail Rodney out with a double-play grounder to Morrison at first base, and the force at second base was routine.

But Dozier tried to hit a moving target as Rodney scrambled to cover first, and the ball wound up in a camera well, an error that allowed Davis to score the tying run. “I thought it was a good chance at a [double play], but it’s always a tough feed from second to the pitcher,” Morrison said. “[Rodney] is running and looking back at second. It’s not easy.”

Only one who wasn’t buying that explanation: Dozier.

“Shoulda, coulda, woulda. If I make a better throw, the game’s over,” the Gold Glove second baseman said. “Yeah, it’s a tough play, but we’re major league players. I’m supposed to make that throw.”

Maybe he should look on the bright side: This way he got to celebrate a walkoff.

With two outs in the bottom of the inning, Kepler swung at a couple of 94-mph fastballs from Peacock, fouling one off, and took three balls. Kepler then fouled off a slider — and then got another one.

“I wasn’t trying to hit a homer,” said Kepler, whose first career homer, vs. Boston in 2016, also was a walkoff blast.

“I wasn’t really expecting anything, I was just trying to see the ball out of his hand and keep it simple.”