MINNEAPOLIS – Joe Nathan came to the Minnesota Twins in 2004 as an unknown middle reliever with one career save on his resume.

Seven years, four All-Star appearances, 255 saves and one Tommy John surgery later, Nathan is the best closer the Twins have ever had.

Nathan set the franchise record for saves and Jim Thome hit a tiebreaking RBI double during Minnesota’s three-run eighth inning to help the Twins beat the Boston Red Sox 5-2 on Wednesday night.

Nathan worked a perfect ninth, getting Mike Aviles, Jacoby Ellsbury and Marco Scutaro for his ninth save of the year and surpassing Rick Aguilera on the franchise’s career saves list.

“Just with the surgery and everything, the bumps in the road, I think it made it mean even more,” said Nathan, who missed all of last season with the elbow surgery. “To be able to come back and accomplish this, more importantly we got a win and obviously we needed some wins.”

Thome also had a run-scoring single and the Twins got an outstanding effort from Nick Blackburn to snap a six-game losing streak and avoid a sweep.

Thome hit the 119th pitch from Jon Lester (11-6) over Carl Crawford’s head in left field for a 3-2 lead. Blackburn gave up an unearned run and six hits in 6 2/3 innings.

David Ortiz went 2 for 4 with a homer and Lester gave up four runs and eight hits in 7 1/3 innings for the Red Sox. The left-hander also issued five walks, tying a season high.

“I felt like I had pretty good stuff, but I just wasn’t able to locate,” Lester said. “I gave them too many opportunities. When you do that, that’s what happens.”

For a while it was unclear if Nathan would even get a chance to break the record.

The Red Sox were losing 2-1 when Ortiz stepped into the box in the eighth against lefty Glen Perkins, who has been dominant this season but has struggled a bit in the last week.

It was power against power, and Perkins gave him straight gas the entire showdown. He hit 96 mph on six pitches before cranking up and reaching 98 on his final pitch to Ortiz, who sent the pitch 419 feet into the bullpen behind center field. It was the first homer off Perkins this season in 178 plate appearances. Success against his former team is nothing new for Ortiz, who was allowed to leave the organization after the 2002 season. He is hitting .333 (54 for 162) with 12 homers against the Twins, and is 9 for 19 (.474) at Target Field.

But Thome ripped a double to the left-center field gap to score Joe Mauer, Danny Valencia added an RBI double and Tsuyoshi Nishioka came through with a run-scoring single off Alfredo Aceves to give Nathan a little breathing room heading into the ninth.

“To get No. 255, it’s obviously an honor to me to pass such a great pitcher in (Rick Aguilera),” Nathan said. “To be able to take over his record means a lot to me.”

Nathan never would have had the chance if not for Blackburn’s sharp performance.

“It was the kind of effort he needed and the kind of effort we needed,” Twins Manager Ron Gardenhire said.

Few could say they saw this outing coming from him. In his previous eight starts, he was 3-5 with an 8.15 ERA and 65 hits allowed in 382/3 innings.