Deng's game-winner came after Kyle Lowry had tied it for Toronto with 8.7 seconds to go.
Chicago led by as many as 16 during the third quarter, but the Raptors came back to tie it on a free throw by Amir Johnson with 12 seconds left in regulation. Johnson missed a second foul shot that would have given Toronto the lead.
Toronto's Jose Calderon misfired on a 3-point attempt with a second left in the extra period that would have forced a second overtime.
The Raptors have lost three in a row following their best stretch of the season in which they won 10 times in 13 outings.
Alan Anderson led Toronto with 27 points and Lowry had 26.