MINNEAPOILS -- Curt Schilling threw one of his best games of the season, but he wasn't in contention for the win when he exited in the eighth on Tuesday.

And four innings later, the Red Sox weren't on the winning side, either.

After Boston scored the go-ahead run in the top of the 12th inning, reliever Julian Tavarez gave up a walk-off grand slam to Jason Kubel, who lofted a 3-2 pitch over the wall in right field as the Red Sox lost, 5-2, at the Metrodome.

"He ended up just getting enough of it to hit it out," said catcher Jason Varitek, whose seventh-inning solo home run gave the Red Sox a 1-0 lead.

"I thought at first it was just a sacrifice fly. He hit it better than I thought."

Schilling didn't become the Major League's first 10-game winner, but had his best outing -- statistically -- since May 22 against the Yankees. He was locked in a pitch-for-pitch duel with Minnesota ace Johan Santana as the pair combined for 16 innings, 18 strikeouts and just 11 hits. Each surrendered a solo home run in the seventh inning.

For Schilling, it was a classic game against an equally dominant pitcher -- a battle he doesn't see too often.

"It's been a while," he said. "That was a game."

Schilling threw eight innings, making just one mistake -- a solo home run to Michael Cuddyer with two outs in the seventh that tied the game at 1. Schilling utilized 11 ground-ball outs and struck out five.

The veteran right-hander said he knew early he couldn't make a mistake if he wanted to win, as Santana struck out the first five Red Sox hitters and finished with a season-high 13 strikeouts. But Schilling said he didn't get caught up in Santana's game.

"He was dominating so quickly and thoroughly," Schilling said of his counterpart. "I'm not trying to get him out. I'm trying to get his hitters out.

"I had to stay with what we planned on doing and stay within myself and not try to match him strikeout-for-strikeout."

The Red Sox had a chance to score in the ninth inning, when Mark Loretta led off the frame with a single and Willie Harris, who was the pinch-runner, reached second on a wild pitch. But Twins closer Joe Nathan struck out Manny Ramirez and forced Mike Lowell to fly out to end the threat.

In the 12th inning, after Varitek began the frame with a strikeout, the Red Sox hit three consecutive singles off Jesse Crain to load the bases for Alex Gonzalez. He hit a ground ball to shortstop Nick Punto, who flipped it to second for the first out. But Gonzalez beat the would-be inning-ending throw to first base by a step as Lowell scored the go-ahead run.

"We know the way [Santana] was throwing, we weren't going to put up a bunch," manager Terry Francona said. "That's the type of game you hope you can get a run and win, whether it's extra innings or regulation. We got the run and then we couldn't hold them down."

Mike Timlin, fresh off the disabled list, pitched a perfect 11th inning, but Francona didn't want to send him out for a second inning in his first game. He turned to Tavarez, who has now allowed eight runs in seven innings this month.

After catching Minnesota's Joe Mauer looking at strikes to start the frame, Tavarez tallied two strikes on Cuddyer, but hit him with a 2-2 pitch to put the tying run on first base.

"It's not like the game's over, but that's not what you want to do in that situation," Francona said.

Then Justin Morneau shot a ball to the gap in right-center field for a ground rule double. It appeared that Cuddyer could have scored if the ball had stayed in play. With runners on second and third, the Red Sox intentionally walked Torii Hunter to get to Kubel, who was batting .279 with two home runs entering the game.

On Kubel's hit, right fielder Trot Nixon positioned himself at the warning track, as if preparing to make a possible throw to home plate, but the ball sailed over his head and just made it over the baggie to end the game.

"I thought off the bat it was hit good enough," Francona said. "Right field, at times, looks so short here."