The Raptors held on despite 23 points and a huge fourth quarter from old teammate Jose Calderon.
Toronto trailed 108-107 after a 3-pointer by Calderon when DeRozan's pump-fake got Brandan Wright and Shawn Marion in the air. DeRozan threw up a shot as he was bumped and it went in for the final points with 1:11 remaining.
Although he missed the free throws, the Mavericks missed their last four shots, including a runner by Monta Ellis in the final seconds.
Kyle Lowry led four Toronto players in double figures with 20.
Dirk Nowitzki scored 22 for the Mavericks but missed his last six shots, including two on their second-to-last possession while down a point.