ST. PETERSBURG, Fla. - Three outs away from taking a third loss in four nights against the Boston Red Sox, the Tampa Bay Rays rediscovered a missing piece from their recent playoff teams.
"We've been missing a little of the magic this year, and it doesn't' get much more magical than that," Rays manager Joe Maddon said after his club rallied with six runs in the ninth inning for a 7-4 victory Thursday at Tropicana Field.
B.J. Upton's walk-off three-run homer off Vicente Padilla won it, spoiling a stellar outing by Boston's Clay Buchholz in his marquee matchup with David Price.
Upton's 24th homer was his 14th in his last 38 games since Aug. 11 - tying him with Adrian Beltre for the most in the majors in that span.
The win kept the Rays' slim playoff hopes alive. They're still 5 1/2 games back in the wild-card standings with 11 games to play.
Boston, which sealed its first losing streak in 15 years with a 13-3 loss a night earlier, finished its road trip 4-3.
"It was a really good game up until (the end)," Red Sox manager Bobby Valentine said. "(Buchholz) was great; he was terrific. His back stiffened up and he had to come out of the game."
Buchholz pitched seven shutout innings but didn't come out for the eighth despite having thrown only 94 pitches. But he said he said his back problem was just "everyday soreness."
"I had a couple of long innings and felt like somebody else could do a better job than I could for the eighth," he said.
The Rays went to the bottom of the ninth trailing 4-1, but they rallied against Andrew Bailey (1-1).
Desmond Jennings' two-run single off Bailey tied the game after an RBI single by Carlos Pena.
"It's inexcusable," Bailey said. "There's no other way to describe it. I've got to get that job done and find a way to get out of the inning."
Price again didn't get any help from his offense at home. After pitching eight shutout innings in each of his previous two Tropicana Field starts without getting decisions in 1-0 losses, the major league leader in ERA left this one trailing 2-0 with one out in the eighth.
Ryan Lavarnway had doubled and was on second, and he scored on a triple by Mauro Gomez off Wade Davis to make it 3-0 in the eighth.
"I felt pretty good, and I feel like I threw the ball pretty well," Price said. "Buchholz, I feel like he outpitched me."
With Junichi Tazawa on for Boston, Tampa Bay cut the lead to 3-1 in the bottom of the eighth on a sacrifice fly by Ben Zobrist after a leadoff double by Jennings.
Boston's Jose Iglesias hit a solo home run -- his first major league homer -- off J.P. Howell in the ninth to make it 4-1.
Iglesias, who entered the night hitting .057, went 3-for-4 with two runs scored and an RBI.
Cody Ross' two-out double to center after Iglesias beat out an infield single and advanced on a wild pitch gave Boston its first run.
Lavarnway followed with a single off diving shortstop Zobrist's glove, and the Red Sox led 2-0.
The Rays wasted a couple of early scoring chances that were presented because Pedro Ciriaco had trouble picking up the ball against the dome ceiling in center field.
Evan Longoria's lead-off fly ball in the second inning fell between Ciriaco and right fielder Daniel Nava for a double, but after Longoria made it to third with two out and Luke Scott walked, Pena whiffed on Buchholz's full-count fastball.
Then, in the third, Ciriaco let Upton's routine fly ball fall in front of him for a double. That brought up the Rays' leading RBI man, Zobrist, but Buchholz again picked up the extra out by coaxing an infield pop out.
Ciriaco, who has played mostly in the infield since his call-up in July, was replaced in the fourth by Jacoby Ellsbury, even though Valentine had planned to give Ellsbury the night off.
The Red Sox put only three men on base through the first five innings against Price, one of them on a fielding error by Price in the first.
Iglesias singled with one out in the third, and Mike Aviles led off with a single in the fifth, only to be caught stealing.
NOTES: Red Sox infielder Aviles' first start of the series was also his first at third base since Game 162 last year. Aviles hadn't worked out at third all year, but with the Red Sox wanting to get the 22-year-old Iglesias some playing time at shortstop, Aviles accepted Valentine's invitation to play the hot corner. "Sitting isn't his cup of tea, for sure," Valentine said. ... Ellsbury entered Thursday hitting .517 against the Rays and .303 against the AL East this year. ... Aviles and catcher Jarrod Saltalamacchia are the only Boston position players who've been active for all 151 games this season. ... With an AL-high (and club-record) 1,256 strikeouts entering Thursday, Rays pitchers were 10 shy of tying the AL season record held by the 2001 New York Yankees. ... Longoria made a second consecutive start at third base, only the fourth time he's played in the field in consecutive starts since coming off the DL on Aug. 7. ... Before scoring a season-high-tying 13 runs Wednesday, the Rays had pushed across only 26 runs over eight games while hitting .201. ... Infielder Elliot Johnson was getting some national attention for responding to a tweet from a fan before Wednesday's game and meeting him in the parking lot to play catch.