ST. PETERSBURG, Fla. (AP) -- The Tampa Bay Devil Rays held off mathematical elimination to put a dent in Toronto's fading playoff hopes.
B.J. Upton's pinch-hit, two-run homer capped Tampa Bay's four-run rally in the ninth inning and lifted the Devil Rays to a 5-4 victory over the Blue Jays on Saturday night.
"That's the name of the game, having fun," Upton said. "Everyday we got out there, we want to have fun and at the same time win. We got to do both tonight."
Tampa Bay's seventh win when trailing after eight, coupled with the New York Yankees' 11-5 victory at Kansas City, dropped the Blue Jays 7 1/2 games back in the AL wild-card race. The Devil Rays would have been the first major league team to be mathematically eliminated if they had lost.
"It's a heartbreaker," Toronto manager John Gibbons said.
Carl Crawford opened the Devil Rays' ninth by reaching on an error when shortstop John McDonald misplayed his grounder. One out later, Delmon Young hit a two-run homer off closer Jeremy Accardo (4-4), who blew his fifth save in 32 opportunities, to pull the Devil Rays to 4-3.
"That was fun," Young said. "We always know we have a chance to come back, but when they bring in their closer that's been dominant all year, you think twice about it. But C.C. did what he's supposed to do and get on base, and then we just happened to score from there."
Jonny Gomes drew a two-out walk before Upton, out of the starting lineup with a sore left ankle, hit the first pitch for the game-winning, opposite-field homer to right.
"It was just a terrible way things went down," Accardo said. "The two pitches to Young and Upton were where I wanted them, down and in the zone. Those two guys just have a lot of strength. I got out beat by a matter of feet on both. I'm not making excuses, but I've got to out there and do my job."
Al Reyes (2-2) struck out two during a perfect ninth.
A.J. Burnett allowed one run and three hits in eight innings and Alex Rios hit a two-run homer and the Blue Jays appeared headed for their ninth win in 13 games. Burnett also struck out eight and walked one.
Rios hit his 23rd homer of the season, a two-run shot off Jason Hammel to give Toronto a 2-1 lead in the sixth.
Dioner Navarro homered for Tampa Bay. The Devil Rays announced before the game that manager Joe Maddon's two-year option for the 2008 and 2009 seasons was picked up.
"It was a great ending to a very nice day," Maddon said.
Hammel gave up two runs and five hits in six innings. He was coming off a solid outing against the New York Yankees last Sunday in which he picked up his first win as a starter -- coming in his 18th career start -- in the Devil Rays' 8-2 win.
Navarro put Tampa Bay ahead 1-0 on a second-inning homer. He has hit seven of his eight homers since the All-Star break.
Upton hit a hard foul off the ankle in the ninth inning of Friday night's game. ... Upton's homer was the third game-winning pinch-hit shot in team history, and the first since Eduardo Perez did it on April 22, 2005 against Boston. ... Stairs had two hits in three at-bats to extend his hitting streak to eight games. He is 15-for-27 over the stretch. ... The Blue Jays are 63-6 when ahead after eight innings.