TORONTO -- After spending much of the fourth quarter fastened to the bench with foul trouble, Rudy Gay couldn't wait to get back in the game and make the big shot.

When Raptors head coach Dwane Casey could finally put him back in, Gay didn't disappoint. He drained the winning bucket with 4.8 seconds to play and Toronto won its third straight by defeating the short-handed Denver Nuggets 109-108 on Tuesday night.

"My hands were sweating, I couldn't stop moving my legs. I was itching to get back in," said Gay, who finished with 17 points after leading Toronto in scoring with 20 or more points in all five games since coming over in a trade with Memphis.

"Obviously it's not a game I'm proud of, but I'm proud to get a win with the team. I'm happy the team still had confidence in me."

DeMar DeRozan had 22 points and John Lucas had another big final quarter with 12 of his 14 points in the fourth -- all coming on threes.

Alan Anderson chipped in 10 points, all in the fourth quarter, while Kyle Lowry added 11 points and 10 assists for Toronto (20-32).

Gay has become the Raptors' go-to clutch shooter late in the game. His game-winner Tuesday was similar to the 17-foot jumper he hit in Indiana with 1.7 seconds left in overtime to send the Raptors past the Pacers 100-98 on Feb. 8.

"He's a closer," said Casey. "His role card has closer all across the front of it. He has done it his whole career. He has done it at high levels, like in the playoffs. I have seen him do it so many times. That is what he does.

"Everyone else is growing into that role. DeMar is going to be there soon. Sooner or later someone is going to take out the first option, so you need someone else to step into that role."

Speedy point guard Ty Lawson paced Denver (33-20) with 29 points and nine assists. The Nuggets lost their second straight after having a nine-game win streak snapped Sunday with a 118-114 triple overtime loss in Boston.

Denver was missing starting guard Andre Iguodala (neck strain), small forward Danilo Gallinari (sinus infection) and reserve guard-forward Wilson Chandler (groin).

"That's tough," Lawson said of the injuries. "We didn't know till today, so we couldn't really plan for it."

Lucas, who scored 10 points in the fourth quarter of Sunday's win over New Orleans, went to work from downtown early in the final quarter, jacking up three straight threes to give Toronto a 91-83 cushion. After Denver pulled back within two, Lucas hit another three before dishing to Anderson who dropped in a long ball to make it 100-94 with five minutes left.

Lawson's six points in the paint and a reverse layup from Corey Brewer rallied Denver and the game was tied 102-102 with just under three minutes to play.

Two minutes later Toronto held a slim one-point lead, but Denver stopped Gay on a drive before drawing a foul at the other end. Anthony Randolph converted to put the Nuggets in front by one, but with seconds on the clock Gay hit a jumper from the wing and the Air Canada Centre erupted.

"I think if we have Gallinari or Iguodala on him, we might make him miss that shot" said Denver head coach George Karl. "I don't know. I know Iguodala made him make miss that shot in Memphis this year."

The Nuggets inbounded the ball and Lawson's desperation shot clanged off the rim.

Gay picked up his fourth foul early in the third and had to watch from the bench as the Nuggets tied the game 63-63 on two Kenneth Faried dunks and a Lawson fast-break layup. After Casey called timeout, the Raptors immediately turned the ball over, leading to another Faried slam and Denver's first lead of the game, 65-63 at 7:02.

Boos could be heard as Andrea Bargnani -- returning to action after missing Sunday's game with the flu -- missed an open three and a pull-up jumper in the final minutes of the quarter, which Toronto closed out ahead 82-78 thanks to Lucas' layup and DeRozan's short jump shot.

DeRozan absolutely posterized Nuggets centre Timofey Mozgov seconds into the second quarter with a thunderous one-handed jam, putting Toronto up 30-21.

"I can't even tell you what I said when I saw it ... one of the craziest dunks I've ever seen," said Gay. "The sky's the limit for him, he's an incredible talent."

Raptors rookie Terrence Ross got in on the aerial attack with a Blake Griffin-like slam midway through the quarter -- a glimpse of what he plans to bring to the upcoming all-star dunk competition.

The Raptors, however, played sloppy late in the second as Denver went on a 9-0 run and Lawson poured in 14 points in the quarter to cut the lead to 54-52 going into intermission.

The ACC crowd was on its feet early when DeRozan, soaring through a wide open lane, slammed home a one-handed dunk to make it 13-5. Gay followed that with a layup at 6:31, forcing Denver to call time out, and minutes later dropped a three to make it 22-9. He finished the opening quarter with 13 points.

Both teams head to New York to plays their final game on Wednesday before this weekend's all-star break in Houston. Toronto takes on the Knicks at Madison Square Garden, while Denver is across the Brooklyn Bridge taking on the Nets.

Notes: Toronto was without Linas Kleiza (sore right knee). ... Denver has won 15 of its last 18 games against the Raptors. ... Raptors coach Dwane Casey was an assistant coach for Denver coach George Karl in Seattle. ... Karl came into the game needing one win to reach for 400 with Denver. He is 48 wins shy of Phil Jackson (1155) on the all-time list. ... Canadian Olympian Clara Hughes was seated courtside. Hughes is leading a campaign to support mental health issues using the Twitter hashtag #Bellletstalk. ... Attendance was 16,738.