Gay finished with 26 points and DeMar DeRozan added 25 for the Raptors, who ended the Timberwolves' brief two-game winning streak and denied Minnesota Coach Rick Adelman his 1,000th career NBA victory.
Gay hit a turnaround bank shot that put the Raptors in front 94-91 and twice during the final minute Minnesota players could make just 1-of-2 from the foul line.
Ricky Rubio suffered that fate with 1.7 seconds remaining, leaving Minnesota trailing by one.
Toronto's Amir Johnson was fouled on the rebound and he made 1-of-2 from the line with a tenth of a second remaining for the final score.
Nikola Pekovic led Minnesota with 24 points.
Notable deaths of 2014 [PHOTOS]