Ellis -- Oakland's No. 14 -- also scored four times, including the tying run in the ninth and the go-ahead run in the 11th. Both times he was singled in by Rajai Davis.
"They fell in for us. That just happens," Davis said. "That's nothing against that bullpen. It's a tough game to be perfect in."
Boston led 7-4 when Papelbon came in for the ninth, but he walked the leadoff hitter and gave up three hits; he was also hurt by two throwing errors by shortstop Nick Green. It was still 7-7 with two out in the 11th when Ellis doubled off Manny Delcarmen (2-2) and scored on Davis' single to right.
"The odds of pulling that off are slim, and we did it," said A's manager Bob Geren, whose team came back from a 10-run deficit earlier in the season. "We pulled off some late-inning heroics this year a few times. But tonight was big at this ballpark against that team."
And against a bullpen that hadn't allowed a run in 25 innings since the All-Star break.
"It's tough. What am I going to do? Things like that happen," said Papelbon, who blew just his third save in 28 opportunities. "You've got to and move on and get ready for tomorrow."
Davis scored on Adam Kennedy's career-high fifth hit to make it 9-7. Craig Breslow (4-4) pitched a perfect 10th for the win, and Andrew Bailey earned his 12th save despite giving one run back in the 11th.
Delcarmen gave up two runs on three hits, striking out one in 1 2/3 innings.
"He was a little bit fatigued at the end and that's not his fault," Red Sox manager Terry Francona said. "We got to the ninth with Pap, and a lot of things happened to get there, but we feel pretty good about the game when that happens."
One night after the slumping Red Sox offense broke out with 14 hits, the club hung Rice's No. 14 on the Fenway facade to honor the Hall of Fame slugger.
Kevin Youkilis had three hits for Boston, including a two-run to spark Boston's five-run third inning. J.D. Drew had three hits, including a pair of doubles; he is 8-for-20 in the homestand following an 0-for-24 slump.
Jacoby Ellsbury had two of Boston's 14 hits for his fifth multihit game in a row. He also had an RBI groundout in the 11th to make it 9-8, but Bailey got Dustin Pedroia on a harmless fly ball to left.
Orlando Cabrera had three hits as the A's avoided falling 17 games below .500 for the first time since 1997.
Clay Buchholz, who has been sought after in trade talks, got into trouble in three of the first four innings. But he left with a 5-2 lead, and Ramon Ramirez gave up one run, Hideki Okajima another and Papelbon allowed three in the ninth -- two earned.
The last-minute outburst rescued Vin Mazzaro from an eighth loss in his last nine starts.
Boston led 5-2 after three, 6-2 after six and 7-4 at the end of eight innings. Papelbon came in to pitch the ninth, but Cust drew a leadoff walk and scored on Tommy Everidge's first major-league hit -- a double high off the Green Monster.
Ellis reached on an infield single that scored Everidge and took second on Green's first throwing error. Ellis stole third and scored on Rajai Davis' infield single; he went all the way to third on another error by Green.
Papelbon struck out Kennedy to end the inning and send the game into extras.
Geren was ejected for yelling something from the dugout in the five-run third. ... The A's placed INF Daric Barton on the 15-day disabled list with a strained left hamstring and recalled Everidge from Triple-A Sacramento. Everidge made his major league debut. ... David Ortiz is expected to get the day off on Wednesday, when the A's will pitch lefty Brett Anderson. Adam LaRoche pinch hit for Ortiz in the seventh inning. Ortiz left the ballpark to go to the hospital and be with his daughter according to Francona, who said it was precautionary.