First, Kenta Maeda lost his no-hit bid.

Then the Twins bullpen lost the lead.

But they didn't lose the game.

It took a while, but the Twins eventually shook off blowing a 3-0 lead in the ninth to beat Milwaukee 4-3 in 12 innings when Byron Buxton raced home from third to score on Jorge Polanco's soft grounder to second.

Buxton started the inning at second, as per the new extra-inning rules. Alex Avila grounded out to first, allowing Buxton to move to third. Max Kepler, facing a five-man infield that included Ryan Braun back at third base, was hit with a 3-2 pitch. And Polanco's trickler was fielded by Luis Urias at second, but his throw home was too late to catch the sprinting Buxton -- who amazingly grounded into double plays in his final two at-bats.

The Twins avoided a crushing loss on a night in which Maeda dominated and set a team record with eight consecutive strikeouts.

He took the mound in the ninth inning looking to make Major League Baseball history as only the third Japanese pitcher to throw a no-hitter.

But his brilliance had expired the inning before, as he needed 21 pitches to get through the eighth and dared manager Rocco Baldelli to replace the guy pitching the game of his life.

Maeda earned the opportunity, Baldelli decided, and went to the mound despite throwing a career-high 113 pitches.

But infielder Eric Sogard lifted a 0-1 changeup just out of the reach of shortstop Jorge Polanco and into center field for the Brewers' first hit of the game.

"It's been awhile since I've threw so many pitches like I did [Tuesday]," Maeda said. "The hit I gave up was a weak-contact hit. The pitch, I think I executed the pitch and there was nothing I could do. It's a hit."

Instead of tossing the sixth no-­hitter in Twins history, Maeda became the sixth Twins pitcher to lose a no-hit bid in the ninth inning, the first since Kansas City's Mike Sweeney singled off Scott Baker on Aug. 31, 2007.

"That was one of the best games I've ever seen pitched in baseball," Baldelli said. "He's facing a team that he just faced last week with good hitters. He dominated. He did everything you can possibly do. He was in total control."

In addition to losing the no-no, the Twins proceeded to let their 3-0 lead in the ninth slip through their fingers with closer Taylor Rogers on the mound in relief of Maeda.

Avisail Garcia followed Sogard's hit with a double. Rogers then walked Christian Yelich and Keston Hiura singled to center to drive in a run. Jedd Gyorko, who homered off Rogers last week, pinch hit and grounded into what should have been a double play, but newest Twin Ildemaro Vargas' throw to first was off the mark for an error, and two runs came in to tie the score.

That led to the Twins playing extra innings in the new format for the first time — the player who made the last out of the previous inning starts the next at second base. Caleb Thielbar got through the top of the 10th, then Jorge Alcala pitched the 11th and 12th to earn his first major league win.

Marwin Gonzalez was ejected in the 10th for arguing balls and strikes, and Luis Arraez left the game after the ninth because of an undisclosed injury.

"Things were flying in every direction throughout the game," Baldelli said. "I even looked at [bench coach] Mike Bell next to me and a couple of the other guys in the dugout, and I kind of said just that — 'There's a lot going on right now. It's going on pretty fast.' But our guys, regardless of all the craziness, they were very calm and focused and were able to keep playing and making the plays."

Before that, Maeda overpowered Brewers hitters, who occasionally turned to ask home plate umpire Jeremie Rehab if the pitches they were swinging at and missing were strikes.

It included a record-breaking run that started in the third inning.

Sogard foul-tipped a changeup for strike three. Garcia was blown away by a fastball. Yelich struck out on a slider. And Hiura fanned on a changeup.

Justin Smoak stared at a fastball away. Braun foul-tipped a fastball to strike out. Omar Narvaez swung and missed at a changeup. And Matt Gamel foul-tipped a fastball right into Avila's mitt.

Eight Brewers up, eight Brewers down. All by strikeouts.

The eight consecutive strikeouts broke the Twins record of seven shared by Francisco Liriano in 2010 and Jim Merritt in 1966 and was one short of the American League record.

"I realized that I was in a no-no after the fifth inning, and all of my pitches were working great," said Maeda, who has a 2.27 ERA. "So that's when I realized and started pitching [like] I'm in a no-no."