ORLANDO, Fla. -- Home court advantage in the first round of the playoffs may be slipping away from the Miami Heat. With three regular-season games remaining, there is no more room for error.
The Orlando Magic, long-ago out of the playoff chase, beat the Heat, 112-109 Friday night, dropping their in-state rival into a tie for fifth place in the tightly-packed Eastern Conference race.
The Heat (46-33) still could finish anywhere from third to sixth. Only the top four teams receive home court advantage.
"Home court is really important to get," veteran Heat forward Joe Johnson said after scoring 13 points Friday night. "If you plan on advancing, it certainly helps to get a Game 7 on your home court. This loss hurt."
The Heat finish the season with a home game Sunday against the Magic, then road games with the Pistons and Celtics.
The Magic were led by center Nikola Vucevic with 29 points and six rebounds. He also nailed the game-winning dunk with 20 seconds remaining.
Forward Evan Fournier had 28 points, seven rebounds and seven assists. He hit 12 of 15 free throws and seven of 12 from the field in one of his better shooting nights.
The Magic (34-45) snapped the Heat's two-game winning streak, which had raised their hopes of finishing the season in third or fourth place in the Eastern Conference.
Point guard Elfrid Payton had 16 points and 10 assists for the Magic. Victor Oladipo, who left the game late in the third quarter with a cut over his left eye, had 13 points. Rookie Mario Hezonja added nine points.
The Magic led 111-109 after Vucevic's dunk that followed a game-tying 3-pointer by Johnson with 30 seconds left. Fournier hit one of two free throws with 2.9 seconds remaining.
"If we don't have home court advantage, oh well. We start on the road," Wade said. "If we don't win enough games to get home court, you still have a playoff series to play. You have to win on the road if you are going to be considered a good team. Once the regular season is over, you move on to the next season, the playoffs."
The Heat made just 11 of 21 free throws and the Magic were 21 of 28. The Heat held a 53-37 rebound advantage, but the Magic shot 52 percent (43 of 82) from the field, compared to just 45 percent (45 of 100) for the Heat.
"You have to make plays, and we made some big plays tonight," Magic coach Scott Skiles said. "I thought our composure, overall, was pretty good tonight."
Neither team led by more than five points in the fourth quarter. The lead changed hands or the score was tied 10 times.
The Magic took a 105-101 lead on a 3-pointer by reserve guard C.J. Watson, who was playing for Oladipo. He scored again for the 109-104 lead with 59 seconds remaining.
The Magic grabbed a 102-97 lead with 3:08 remaining after a three-point play by Payton and a technical foul on Whiteside that was converted.
Heat coach Erik Spoelstra, though, did not agree with the technical called against Whiteside, who was responding after being hit in the face to stop a dunk attempt.
"I don't think it needed to be a technical," Spoelstra said. "I think that was an opportunity to let that defuse and let him express momentary piece of emotion and then move on. But it wasn't called that way."
Oladipo left the game late in the third quarter after trying to take charge but was hit in the face by an elbow from Whiteside. It opened a cut over his left eye that required six stitches.
The Magic made a 10-0 run early in the third quarter to grab a 64-60 lead. Oladipo scored five consecutive points midway through the quarter. After Oladipo left the game, the Heat made a 7-0 run for the 80-77 lead.
The Heat led 55-53 at intermission. They got 10 points and eight rebounds from Luol Deng and 25 points from four reserves before intermission.
Vucevic and Fournier had 17 and 14 points, respectively before halftime, but the Heat outrebounded the Magic 29-17.
NOTES: Magic C Nikola Vucevic returned to the starting lineup after playing the previous four games in a reserve role when he averaged 21.5 points and shot 64 percent from the field. ... The Heat came to Orlando having beaten the Magic in 14 of their last 15 meetings. ... ESPN announced it would add the Miami-Boston season-ending matchup on Wednesday to its schedule and drop the Orlando-Charlotte game that it was supposed to televise that night. ... The Heat and Magic play again Sunday in Miami. ... F Ersan Ilyasova got his first Magic start on Friday, replacing Aaron Gordon, who sustained a concussion Wednesday when he was hit in the head by teammate Jason Smith. It could end Gordon's season. Ilyasova was a starter in Detroit earlier this season before he was traded to the Magic in February. ... Heat C Hassan Whiteside, who leads the NBA in blocked shots, has been bothered with a sore right thigh. ... Former NBA player Jason Williams, who played for both the Heat and the Magic, watched the game from a courtside seat on Friday night.