Jonas Valanciunas added five free throws in the final 10.7 seconds to ice the win for Toronto, which recorded its 11th straight win.
Harrison Barnes had 27 points for the Mavericks, who had opened a four-game trip with a 110-97 win at New York on Tuesday.
DeRozan's close-range shot came after he, Delon Wright and Fred VanVleet had buried 3-pointers in the overtime session, allowing the Raptors to catch and pass the Mavericks, who had gone up by four early in the period.
After forging a 115-all tie on a 3-pointer by Dwight Powell, Dallas missed its last two shots and mixed in a turnover.
Toronto had two opportunities to win it in regulation, but with the score tied at 106-all, Serge Ibaka couldn't connect on a runner in the lane with 1.2 seconds left, and DeRozan misfired on a buzzer-beating follow shot.
Dallas blew an eight-point lead over the final 5:25. The Mavericks went the final 2:52 without a field goal, committing three consecutive turnovers before missing their last two shots.
Valanciunas finished with 21 points and a game-high 12 rebounds for Toronto, which won while resting guard Kyle Lowry.
VanVleet had a game-high eight assists to go with 14 points for the Raptors while Wright added 15 points, Ibaka and Pascal Siakam 12 apiece and CJ Miles 10.
Dennis Smith Jr. backed Barnes with 19 points for the Mavericks, who led for most of regulation play.
J.J. Barea collected a team-high six assists to go with 18 points, Powell had a team-high eight rebounds to complement nine points and Yogi Ferrell had 12 points for Dallas, which had beaten Toronto 98-93 in their earlier meeting in Texas.
Up 60-54 at the half, the Mavericks extended their lead to 11 on three occasions in the third quarter, the final time on a Ferrell jumper that made it 84-73 with 1:18 left in the period.
Dallas led 84-78 at period's end.
--Field Level Media
Dallas | Toronto | |
Harrison Barnes 27 | Scoring | DeMar DeRozan 29 |
J.J. Barea 6 | Assists | Fred VanVleet 8 |
Dwight Powell 8 | Rebounds | Jonas Valanciunas 12 |
Harrison Barnes 4 | Free Throws Made | DeMar DeRozan 12 |
Nerlens Noel 5 | Steals | Delon Wright 2 |
Nerlens Noel 3 | Blocks | Jakob Poeltl 2 |
Team | Points | FG% | 3PM-3PA | FTM-FTA | Assists | Rebounds | Blocks | Steals | Turnovers |
Dallas | 115 | 52.7 | 6-22 | 13-18 | 25 | 36 | 5 | 7 | 12 |
Toronto | 122 | 47.3 | 10-30 | 26-31 | 26 | 45 | 8 | 5 | 14 |