Twins righthander Tyler Duffey doesn’t think he’s ever dropped a baseball while standing on a mound before. Not until the fourth inning Wednesday.

“I was like, everything bad that could happen has happened,” he said. “I just had to keep going.”

Duffey was charged with a balk, which occurred in the middle of a five-run inning by the Royals, and it seemed, at the time, to epitomize a bungled Twins season.

These Twins usually stay behind once they fall behind, but Wednesday was different. Duffey straightened himself out, the Twins’ offense responded and they pulled off a 7-5 comeback victory that enabled them to avoid being swept by the defending World Series champions in the three-game series at Target Field.

After giving up five runs in the fourth, Duffey pitched until he was lifted with two outs and two runners on in the seventh. At 2-3, he is the first Twins starter to win two games this season — and he wasn’t even on the team until he was called up April 23. It ended a run of 17 games in which a Twins starter attempted to pick up win No. 2 and failed.

Down 5-3, the Twins fought back with an RBI double by Eduardo Nunez in the bottom of the fourth before a two-run homer by Miguel Sano in the fifth gave them a 6-5 lead. It was Sano’s first homer in 29 plate appearances.

Byung Ho Park added an RBI single in the seventh. And the Twins bullpen wasn’t leaky this time; Trevor May got a big strikeout of Lorenzo Cain to strand two runners in the seventh. Taylor Rogers pitched a scoreless eighth, and Kevin Jepsen picked up his fourth save with a scoreless ninth.

As soon as Duffey overcame the rocky fourth inning, the Twins rewarded him by playing solid baseball. And for the first time in 24 games, the Twins defeated an AL Central team other than Cleveland.

“It’s not like we haven’t given ourselves opportunities,” Twins manager Paul Molitor said. “It’s just that we haven’t been able to finish. [Wednesday], we hung with it and had enough pitching to close it out.”

The Twins gave Duffey a 2-0 lead in the first inning when Nunez and Brian Dozier led off with back-to-back home runs — the fifth time in Twins history that the first two batters of the game homered and the first time since Danny Santana and Dozier did it on June 9, 2014. For Dozier, who didn’t start the first two games of the series after his batting average dropped under .200, it was his first home run in 50 plate appearances. Santana’s RBI single in the second inning made it 3-0.

Duffey looked as if he had the upper hand in his duel with Royals righthander Dillon Gee (1-2), until the disastrous fourth.

Duffey gave up a single, a walk, a balk, two doubles, a triple and a run-scoring wild pitch in the inning. Pitching coach Neil Allen went to the mound in the middle of the inning and huddled with him again when the inning was over.

“I gave up five and we’re still in it, I told myself,” Duffey said. “Neil let me know that, ‘Hey, you are not coming out. We’re doing this thing.’ I didn’t want to come out, and I didn’t want to end on that note. It was my job to get us deep.”

Duffey retired seven of the next nine batters he faced to reach the seventh inning, having put his unusual balk well behind him.

“After that,” Duffey said. “I did hold the ball firmly in my hand for the rest of the game.”