Duncan Robinson added 21 points, including 10 in the fourth quarter, for Miami (12-9). The Heat were missing all-star centre Bam Adebayo (left hip contusion) and leading scorer Tyler Herro (right ankle sprain).
Former Raptor Kyle Lowry was met with an ovation during pre-game introductions. He had three points in 28 minutes of action.
Pascal Siakam scored 30 points for Toronto (9-12), which has lost four of its last five games.
Both sides were coming off four-day breaks, having last played on Saturday.
Toronto defended the paint well, blocking three shots without surrendering a basket inside in the first 4:21 of the contest. However, Miami jumped out to a 15-4 lead going 5-of-7 from three-point range, with Martin scoring nine of his 15 first-quarter points in that span.
A 17-4 run, fuelled by Anunoby's eight points, allowed the Raptors to make it 26-24 for the Heat with 2:14 remaining. But Miami closed the frame up 37-32.
Toronto tied the game with 3:57 left in the second quarter behind a 10-3 run capped by a Siakam mid-range fadeaway jumper. Siakam then gave the Raptors their first lead, 60-57, since the opening basket of the game with a corner three just over a minute later.
Toronto went into halftime ahead 66-64.
Miami came out the more aggressive and focused side, restoring its lead with a 16-0 run in the opening 6:04 of the third quarter. The Raptors committed seven turnovers in that span alone.
Siakam snapped the dry spell with a three-point play with 5:34 left in the frame.
Trent later hit back-to-back threes to bring Toronto within three with 34.1 seconds left. The Heat held an 87-84 lead at the buzzer.
After Scottie Barnes tied the game 2:19 into the fourth quarter, Miami answered with a 10-0 run from 9:15 to 7:11 remaining. Barnes then trimmed the deficit to 97-94 with 3:56 left going on a personal 5-0 run after a quiet first three quarters.
A 9-2 run between Duncan Robinson and Orlando Robinson, however, put the Heat ahead 106-96 with 1:43 remaining and the Raptors never recovered.
Lowry is in the last of a three-year deal with Miami and currently in his 18th NBA season. While he doesn't plan to retire just yet, he does intend to do so as a Raptor when the time comes.
"I’m definitely retiring as a Raptor," he said earlier Wednesday. "That’s something I’ve said since I left here. I will sign that (one) day contract and I will retire as a Toronto Raptor. That’s just how it’s going to be. Unless I die before that.”
The 37-year-old guard played for Toronto from 2012-2021, where he blossomed individually and played a key role in the team's rise and title run in 2019. Lowry made six all-star teams and was named to the all-NBA third team in 2016 during his time north of the border.
The Raptors head to Charlotte to take on the Hornets on Friday.
The Heat head home for a Friday tilt against the Cleveland Cavaliers.
This report by The Canadian Press was first published Dec. 6, 2023.
Abdulhamid Ibrahim, The Canadian Press