Carlos Correa walked into the batting cage behind the Twins dugout during the seventh inning Thursday and found the pitching machine had been tampered with. The arm had been raised extra high, and the computer was programmed to throw lefthanded sliders.

Turns out, Ryan Jeffers was working on a very specific project.

"He said, 'I'm going to hit Will Smith's slider, and he's got the high release,' " Correa said. "And when he came up to bat, I was like, 'Will Smith is going to throw him a slider, and [Jeffers has] been practicing the slider for two innings already.' "

Smith did. Jeffers was ready.

The pinch hitter blasted that first-pitch slider 427 feet into the second deck in left field, turning a tie game into a thrilling 7-5 Twins victory over the Rangers at Target Field.

"One of the best wins of the year," Correa said. "That was awesome."

The Twins offense and bullpen were awesome on a night when the recently awesome Pablo López wasn't. The righthander's career-longest 19-inning scoreless streak lasted only six pitches, with Marcus Semien rifling a down-the-middle changeup into the left field seats.

And López, who had not given up a run in his previous three starts and who hadn't allowed a home run in August, surrendered three solo home runs and gave up five runs, matching the combined total of his past six starts. Corey Seager and Leody Taveras also homered, and Travis Jankowski provided a bases-loaded, two-run single in the third.

It turned out not to matter. The Twins hit four solo home runs of their own to rally from a 5-2 deficit and, in the eighth, victimized the Rangers bullpen, one of the best in the league, for three runs. Matt Wallner singled off the right field wall against Josh Sborz, Correa drove him home from first by doubling off the center field wall and, after Smith came in, with two outs, Jeffers finished the comeback with the Twins' fifth home run.

"It's one of those really cool moments where you turn to your dugout and just share the emotion," said Jeffers, who walked slowly up the first base line, then twirled his bat as he began his home run trot. "It just kind of happens. You get in that moment, and you know you got it — the rest, you kind of just blank out, and what happens, happens."

What happened to the Twins was especially gratifying, given that the Guardians lost two games against the Dodgers earlier in the day, restoring the Twins' American League Central Division lead to six games. Texas lost its seventh game in a row and is only one game up in the AL West ahead of both Houston and Seattle.

And if López's scoreless streak is history, maybe Josh Winder has started one. The second-year long reliever shut down the Texas offense for three innings after López's departure, giving up only a pair of harmless walks, perhaps his best outing of the season. Griffin Jax pitched a scoreless ninth to earn his second save of the season.

"If you're into good play and good drama, this was a pretty good day," Twins manager Rocco Baldelli said. "We had to battle. [The Rangers] are tough. They put a lot of pressure on you. But we just chipped away. Our guys came through over and over again."

It turned into a fireworks show, starting with the longest home run of Kyle Farmer's career — a 435-foot rocket into the second deck above the bullpens — in the second inning. Michael A. Taylor homered twice off Rangers starter Andrew Heaney, one of them to straightaway center field, and Royce Lewis smacked one against reliever Chris Stratton.

Taylor's big night gives the Twins a franchise-record 23 home runs from the ninth-place hitters, 15 of them from Taylor. What does that do for an offense?

"It wins ballgames for you," Baldelli said. "He's not the same guy that he was when he walked in the door. He's got some real snap in the bat. And when he's looking for a pitch, he gets hold of it."

Just like Jeffers.

"I have enough confidence in myself, first and foremost. I finally feel confident in what I'm doing," the catcher said. "And that kind of leads to them having confidence in me for those situations."