Now Miami finds itself in a hole in the Eastern Conference standings, where a playoff spot is still available with three games to play.
"It's all a challenge," Heat coach Erik Spoelstra said. "This is the way we have been for the past two-and-a-half, three months. We have been in our March Madness, we feel like every single game has had the feeling of an elimination game for several straight weeks."
The Heat fell behind by as many as 18 points in the first half but entered the fourth quarter down only five points.
A dunk by Hassan Whiteside tied the score at 82 with 4:43 left in the Game but Serge Ibaka answered with a 3-pointer 22 seconds later and the Heat never caught the Raptors again.
Wayne Ellington's 3-pointer cut the lead to three points with five seconds to play, but DeRozan made both his free throws with 4.8 seconds left.
Tyler Johnson banked in a 3-pointer at the buzzer for the Heat that resulted in the final two-point margin.
Raptors coach Dwane Casey said it was a physical game.
"We didn't respond great, we had 18 turnovers for 22 points, so that doesn't say a lot," Casey said. "I thought the game was a very physical game, a playoff-type game.
"For the most part, I thought we handled it well getting in the half-court game, just the full-court pressure we didn't handle. We've got to be able to do that, especially with three guards in there."
Cory Joseph added 14 points off the bench for Toronto (49-31). Kyle Lowry had 12 points and Ibaka added 11 points and nine rebounds before fouling out with 1:35 remaining. Jonas Valanciunas had nine points and 10 rebounds for the Raptors.
James Johnson had 22 points and 10 rebounds for Miami. Goran Dragic scored 18 points, and Whiteside had 12 points and 10 rebounds despite early foul trouble. Ellington scored 12 points off the bench and Josh Richardson had 10.
Whiteside had two fouls in the first three minutes of the game and Spoelstra was not pleased.
"It's a shame those two quick fouls at the beginning," Spoelstra said. "Everything should be decided by the players. ... those can be big decisions."
"You know, man, J.V. (Toronto's Jonas Valanciunas), he was an award-winning actor," Whiteside said. "He throws his head back and it's a foul. It's tough."
The Raptors are in third place, a half-game ahead of the Washington Wizards in the Eastern Conference, after the win.
"You can see that this team has a lot of grit," Dragic said. "Even when we are own big we still fight to the end. We came back, we tied the game and they got that big 3 by Ibaka.
"Unfortunately, we couldn't defend well, especially in the end, but I am proud of my guys' heart, that they didn't give up."
DeRozan scored 16 points in the first quarter and the Raptors led 26-19. The Heat shot 23 percent from the field in the first quarter but were 39.8 percent for the game.
The Raptors led 53-43 at the intermission.
"No team in this league is gonna lay down," DeRozan said. "Everybody's got pride and everybody's playing for something, whether it's individually, team-wise, whatever it may be.
"Guys are not just gonna lay down. They're gonna give you their best shot until the end of the game. We've got to be prepared for that.
"When we get a lead, we have to understand that we can't look at the score. We've still got to treat it like it's 0-0. We can't get complacent at all.
"We can't let one turnover turn into two, give them an opportunity to get out and running and get a couple buckets. We've got to be more confident."
The Raptors took a 16-point lead with 7:19 to play in the third quarter when DeMarre Carroll made one of two free throws.
Richardson scored five straight points to cut the lead to four with 1:38 to play in the quarter.
The Raptors led 70-65 after the third quarter.
Johnson made one of two free throws to cut the lead to one point with 6:45 to play.
Patrick Patterson responded with a 3-pointer for Toronto and the lead was 82-78.
NOTES: Heat F Luke Babbitt (right hip flexor) did not play for the second straight game. ... F James Johnson, usually a reserve, started for the second game in a row. ... Miami G Dion Waiters (sprained left ankle) missed his 10th consecutive game and G Josh Richardson started in his place. ...The Raptors had all of their players available for only the third time this season. ...The Heat will play the Washington Wizards Saturday night at the Verizon Centre. ...The Raptors take on the New York Knicks Sunday afternoon at Madison Square Garden.