David Ortiz had a chance, in his final career at-bat in Minnesota, to deliver one more dramatic victory for the Red Sox. Max Kepler had a chance, less than 24 games into his fledgling career, to win it for his woebegone team.

Even Kepler couldn’t believe which one came through.

“I put my head down running to first, and then I saw it go off the wall,” Kepler said, “and I thought: That was me?”

It was, and he did. The first home run of the German outfielder’s career soared over Boston’s five-man, drawn-in infield, carried over center fielder Mookie Betts’ head and collided with the back wall of the batter’s eye in center, a three-run blast that made the Twins a 7-4, 10-inning winner over the Red Sox at Target Field on Sunday.

“It’s a good moment for a good kid, kind of finding his way,” manager Paul Molitor said. “He’s had some chances to get big hits here. Today he can finally say he had a moment to help us win a game.”

Kepler almost didn’t. With the winning run on third base, Red Sox fireballer Matt Barnes threw a curve that froze Kepler and then a fastball at 98 miles per hour he couldn’t catch, and Kepler was growing angry with himself. “I tried to do too much. I was thinking, ‘I may drive the ball out of the park here,’ ” Kepler said of his swing-and-miss. “On 0-and-2, I kind of shortened it up and got the bat to the ball.”

He did more than that. The ball jumped into the outfield, deep enough that Joe Mauer would be able to tag up and score from third. But it kept carrying, too, and Betts, stationed in right-center in the unusual alignment, chased it for about a half-dozen steps before giving up and turning toward the dugout, not even watching as it struck the back wall, 429 feet away from the plate.

“I’m still in awe,” said reliever Michael Tonkin, who earned the victory with a scoreless 10th inning. “That’s unbelievable. A line drive off the batter’s eye? You don’t see that too often. That’s impressive.”

The Twins had a few impressive performances Sunday and a handful of unfortunate ones, too; the game featured five unearned runs, after all. Pat Dean, who pitched for three seasons at Boston College, held the majors’ best offense to only three hits and one run over 6 ⅓ innings. Eduardo Escobar, who hadn’t been in the lineup for a week, collected two hits and drove in a run. And Tonkin? He spoiled one final clutch curtain-call by Ortiz in his farewell Minnesota moment.

“I’m fine with that,” Tonkin deadpanned. “I didn’t want that.”

Tonkin (2-2) — pitching with a perfectly round, extremely purple imprint of a baseball on his thigh, a souvenir of the line drive that hit him Friday — was called upon to keep the score tied 4-4 in the 10th inning, only the second time in nearly a month he entered without the Twins trailing. The righthander got two quick outs, but then failed to cover the bag in time when Xander Bogaerts grounded a ball to Mauer at first base.

“I was too late to break over there, and I’m not the fastest guy,” Tonkin fumed at himself. “So that was frustrating.”

Especially since it brought up Ortiz, a career .443 hitter with nine homers at Target Field, and Bogaerts ended up stealing second. But Tonkin was feeling good, and he showed no fear. He threw two breaking balls to try to get Big Papi to chase, but “he didn’t even look interested in them.” So he stuck to heat — 96-mph heat.

Ortiz missed at a couple, then fouled one off. And when Tonkin threw yet another fastball on the outside corner, he had his man. Ortiz missed, Tonkin pumped his fist, and the Twins — who blew a 4-1 lead in the eighth following a bases-loaded throwing error by third baseman Eduardo Nunez — had their chance.

Mauer walked. Trevor Plouffe bunted him to second, only the second time this year in all of MLB that a cleanup hitter has sacrificed. Brian Dozier lined a single up the middle off shortstop Bogaerts’ glove. And then Kepler was due.

“I thought Max had a reasonable chance, against a hard-throwing guy, to put the ball in play,” Molitor said. “I wanted to give him a chance.”

Now we know why.