DeMar DeRozan put the Raptors ahead by tipping in his own miss with 3.1 seconds left before Ellington answered with the layup that gave Miami its fifth consecutive victory.
Ellington received an inbounds pass in the right corner and drove the baseline for the winning points as the Heat snapped a five-game losing streak in Toronto.
Goran Dragic scored 24 points and collected a career-best 12 rebounds for the Heat (23-17). Bam Adebayo recorded 16 points and career bests of 15 rebounds and five blocked shots, Ellington scored 15 points, and Hassan Whiteside contributed 13 points and 15 rebounds.
DeRozan scored 25 points for Toronto but shot just 10 of 29 as the Raptors (28-11) had their five-game winning streak halted. Delon Wright scored 13 points while starting in place of point guard Kyle Lowry, who is day-to-day due to a bruised tailbone and back spasms.
Lowry was injured during Toronto's Monday victory over the Brooklyn Nets when he fell hard to the floor after battling for a rebound. He landed on his lower back and buttocks, had to be carried off the court and left the arena in a wheelchair.
Toronto's Serge Ibaka and Miami's James Johnson were ejected for exchanging punches in the third quarter.
The Heat led 84-77 after Adebayo's basket with 4:31 to play before Toronto recovered and appeared to be in good shape after DeRozan's tip. However, a defensive breakdown allowed Ellington to get loose and score his only points of the second half.
Miami led by 12 early in the third quarter before the Raptors responded with 11 straight points. Dragic later scored the final six points of an 8-0 run to account for a nine-point edge, and Whiteside's dunk with 1:22 remaining in the third gave the Heat a 70-58 lead before Toronto pulled within 72-64 by the end of the quarter.
Dragic scored 14 first-half points and Ellington added 13 as Miami held a 51-41 halftime advantage. Dragic capped his strong half with a 13-footer with 19 seconds left to make it a 10-point margin.
--Field Level Media
Miami | Toronto | |
Goran Dragic 24 | Scoring | DeMar DeRozan 25 |
Goran Dragic 4 | Assists | DeMar DeRozan 6 |
Bam Adebayo 15 | Rebounds | Delon Wright 7 |
Derrick Jones Jr. 4 | Free Throws Made | DeMar DeRozan 4 |
Goran Dragic 1 | Steals | Norman Powell 2 |
Bam Adebayo 5 | Blocks | Lucas Nogueira 4 |
Team | Points | FG% | 3PM-3PA | FTM-FTA | Assists | Rebounds | Blocks | Steals | Turnovers |
Miami | 90 | 40.2 | 4-22 | 8-10 | 18 | 64 | 14 | 2 | 14 |
Toronto | 89 | 38.9 | 7-21 | 12-15 | 15 | 37 | 12 | 7 | 5 |