BOSTON -- It's hard to discourage Jim Thome.
Out of the lineup for nearly two months with a herniated neck disk, the Baltimore Orioles designated hitter started his comeback with three consecutive groundouts, followed by back-to-back strikeouts Saturday.
Thome was 0-for-5 as Baltimore teetered on the verge of blowing a 6-3 lead to the slumping Boston Red Sox, yet he was eager for another shot. He got it in the 12th inning and came through with an RBI double, leading the Orioles to a 9-6 win.
"I'm just trying to get into a groove. You want to perform, and you want to get big hits. It might take six, it might take 15 at-bats," said Thome, who was on the disabled list from the end of July until the series opener Friday. "The game is a weird game. That's what makes it so fun. You can be 0-for-5 and continue to be positive and keep battling. Then you get a big hit like that."
The Orioles remain one game behind the New York Yankees in the AL East race after the Yankees rallied for a 10-9, 14-inning win over the Oakland A's.
Thome's hit off of Alfredo Aceves (2-10) bounced over the short wall in right field for a ground-rule double, bringing home Adam Jones, who had led off the 12th with a double.
Endy Chavez and Manny Machado followed Thome with RBI singles to give the Orioles a bit of a cushion for closer Jim Johnson, who allowed a hit but no runs while recording for his major-league-best 47th save.
The Orioles won their 16th consecutive extra-inning game, but this one only went that far because the Red Sox rallied from a 6-3 deficit with two runs in the seventh and another in the eighth.
"I'm tired of playing extra-inning games, to be honest with you," said Jones, who hit his 31st homer of the season to lead off the seventh. "But hey, we're not quitting until that last out is made."
Baltimore improved to 16-2 in extra innings and extended its overall winning streak to a season-high six in a row. Thome, traded by Philadelphia to Baltimore for two minor-leaguers on July 1, is thrilled to be part of a contender again having just turned 42 in August.
"In baseball, you have to have a little -- I don't want to say luck -- but you've got to have a little mojo on your side," Thome said. "You ride it out as long as you can and just don't think about it too much. Just continue to do what you've done."
Tommy Hunter (6-8) pitched a scoreless 11th and got the win for the Orioles, who won for the ninth time in 11 games. The Red Sox lost their fourth straight.
"At the end of the season, the teams that you see go into the playoffs pull out the extra-inning games and win a lot of extra-inning games," Boston outfielder Cody Ross said. "We just haven't been able to do that this year."
The Orioles took a 5-3 lead in the sixth on Ryan Flaherty's triple with two men on, then added to the lead when Jones led off the seventh with a homer.
The Red Sox loaded the bases with nobody out in the seventh, and Ross and Ryan Lavarnway grounded into run-scoring fielder's choices. Orioles reliever Jake Arrieta then struck out Mauro Gomez to preserve the lead for Baltimore, but only temporarily.
Boston's Daniel Nava and Scott Podsednik hit back-to-back doubles with two outs in the eighth off of Pedro Strope to tie the score 6-6.
Boston's bullpen held on until Aceves, Boston's closer earlier this season, started the 12th and was quickly tagged by Jones for a double to center.
"It's kind of like a box of chocolates -- you never know what you're going to get," Boston manager Bobby Valentine said of Aceves.
Mark Reynolds' homer to lead off the fourth cleared the Green Monster and put the Orioles up 3-1. The Red Sox tied it in the bottom of the fourth when Mike Aviles led off with a single and Danny Valencia followed with his third home run of the season.
The Orioles chased Boston starter Aaron Cook in the sixth when Chris Davis hit a one-out single, then Machado doubled on Cook's last pitch of the afternoon. Boston called in reliever Rich Hill to face Ryan Flaherty, who hit a triple to the triangle in center field and put the Orioles up 5-3. Cook allowed five runs on nine hits over 5 1/3 innings, walking two and striking out one.
Randy Wolf, making his second start for the Orioles, pitched five innings, holding Boston to three runs on seven hits with a pair of walks and strike outs.
NOTES: Baltimore second baseman Robert Andino was dressed but not in the lineup after being hit in the head by a pitch Friday night. The Orioles said Andino was undergoing concussion tests. ... The series is scheduled to wrap up Sunday with Baltimore right-hander Chris Tillman (8-2) facing Boston lefty Felix Doubront (11-9). ... The Red Sox will host a postgame celebration Sunday as a tribute to host former player, manager and broadcaster Johnny Pesky, who died in August at 92. Fenway Park, home of "Pesky's Pole" in right field, will remain open for fans who attended the game as well as the general public free of charge. ... Valentine said Daisuke Matsuzaka (1-6) is lined up to start the final game of the season Oct. 3 at Yankee Stadium.