TORONTO -- Rudy Gay's timing was perfect for the Memphis Grizzlies.
Gay scored eight of his 29 points in overtime and the Grizzlies beat the Toronto Raptors 109-102 on Wednesday night to snap a five-game losing streak.
"When you feel good about something, you just keep going to it," said Gay, who made four of five shots in the extra session. "I felt good and I made the best of it."
Zach Randolph had 24 points and 11 rebounds, and Marc Gasol had 12 points and 10 rebounds for the Grizzlies, who had lost seven of their last eight.
O.J. Mayo scored 22 points for Memphis, and Mike Conley added 13 points and eight assists.
"It says a lot about our heart and how much resilience we have," Conley said. "We were down late in the game and we had to come back and fight. It's real big for our confidence and our momentum. It's going to be a game that we can look back on that really helped us turn it around."
The Grizzlies kept calling Gay's number in overtime, taking advantage of a switch that saw him guarded by the smaller Jose Calderon.
"We were running the same play," Gay said. "We got something out of it the first time so we kept on going to it and fortunately it kept on working.
"It didn't really matter who was in front of me. That's just how you feel. It's not the fact that it was Calderon, it's the fact that I had the ball and I had to make something."
Chris Bosh had 32 points and 10 rebounds for Toronto, which had won eight straight home games and eight of nine overall. Andrea Bargnani had 14 points and 10 rebounds.
Calderon had 12 points and nine assists, while Amir Johnson and Sonny Weems each scored 10 points for the Raptors, who topped 100 for the 18th straight game.
"It's tough because we were playing well at home and these are the types of games we need to win," Calderon said.
Randolph, who played much of the fourth and all of overtime with five fouls, had a chance to tie it on a 3-point play with 5:06 left, but missed the free throw. Bosh responded by making two from the line, feeding Bargnani for a hook shot, then beating his chest after blocking a shot and scoring a layup to make it 93-86 with 2:54 remaining.
Mayo scored four points and Mike Conley added a fast-break layup after Weems landed hard out of bounds while trying to save a loose ball, making it a one-point game, 93-92.
Bargnani converted a hook shot before Bosh grabbed the rebound on Conley's miss and drained a jumper at the other end, putting Toronto up 97-92 with 37 seconds to go.
"I think they were kind of relaxed and thought the game was over," Mayo said.
It certainly wasn't. Mayo made a quick 3 and, after Bargnani missed a jumper, Randolph tied it on a driving layup with 1.7 seconds left.
"We could have called timeout and set something up but I felt like we had a break so I wanted to get it up the court real quick," Conley said. "I heard Zach calling my name from behind. I just wanted to bounce him the ball, get it to him where he could score, and he finished it."
Toronto had a chance to win but Bosh missed a jumper from the corner, sending it to overtime.
"These are tough games because we haven't played in a week," Bosh said. "They played last night and they were able to shake their rust off."
Memphis, which lost 109-95 at home to Phoenix on Tuesday, carried the momentum from its late surge into overtime.
"We've been struggling on the second end of back-to-backs, we'd hit a little slump," Mayo said. "Tonight we easily could have quit. We kept believing and kept fighting and we did a great job. Once we got to overtime, we felt like it was a breath of fresh air."
The Grizzlies opened the game with a 13-0 run and made all four of their 3-point attempts in the first quarter to lead 28-16 after one.
"We got off to a slow start and we were very sluggish," Raptors coach Jay Triano said. "We had a hard time getting it going at all."
Toronto's Hedo Turkoglu scored just one point in 29 minutes and missed all five shots he attempted.
Toronto wore its throwback Huskies jerseys and honored former guard Damon Stoudamire, now a Memphis assistant coach, with a video tribute. Stoudamire was the NBA's Rookie of the Year for the Raptors in 1995-96. ... Bargnani threw his mouthguard down in disgust after missing a buzzer-beating jumper in the second.