Kings shooting guard Bogdan Bogdanovic missed the mid-range jump shot that Fox converted into a bucket.
Josh Richardson missed a contested 21-foot shot at the buzzer to seal the Heat's fate.
Reserve shooting guard Buddy Hield led the Kings with 24 points.
The Kings could have taken the lead with 35 seconds left, but Fox missed a 15-foot jumper. Fox later redeemed himself as Sacramento won consecutive games for the first time since Dec. 20.
Heat point guard Goran Dragic, who missed the previous two games due to a bruised left knee, made 8 of 14 shots, including 3 of 5 3-point attempts, and finished with a team-high 23 points.
The Heat were again without shooting guard Tyler Johnson, who has a sprained left ankle and missed his fifth straight game. However, reserve shooting guard Wayne Ellington took up the slack, scoring 20 points and shooting 6 of 13 from 3-point range.
Miami lost consecutive games for the first time in seven weeks. The defeat also snapped the Heat's four-game home winning streak.
Sacramento, featuring 12 players with three or fewer years of experience, started three rookies: Fox, Bogdanovic and small forward Justin Jackson. Fox, who left Sacramento's most recent game with abdominal tightness, scored 14 points. Bogdanovich (11 points) and Jackson (eight points) also contributed.
Kings power forward Zach Randolph, who missed one game due to a sore left knee, returned to the starting lineup and produced 10 points and 10 rebounds.
The Kings led 19-17 after the first quarter. The game was tied 47-47 at halftime, thanks in part to Hield, who had a 13-point second quarter.
Sacramento (50 percent) outshot the Heat (40 percent) in the first half. But Miami made six more free throws and two more 3-pointers.
The Kings surged ahead by eight points midway through the third period, but Miami battled back and took a 72-71 lead into the fourth.
Miami kept its momentum into the fourth, completing a 19-3 run that was nullified by Sacramento's rally.
For the game, the Kings outshot the Heat 46.9 percent to 37.8 percent.
--Field Level Media
Sacramento | Miami | |
Buddy Hield 24 | Scoring | Goran Dragic 23 |
De'Aaron Fox 4 | Assists | Josh Richardson 5 |
Zach Randolph 10 | Rebounds | Hassan Whiteside 14 |
Willie Cauley-Stein 3 | Free Throws Made | Goran Dragic 4 |
Willie Cauley-Stein 2 | Steals | Josh Richardson 3 |
Willie Cauley-Stein 2 | Blocks | Kelly Olynyk 2 |
Team | Points | FG% | 3PM-3PA | FTM-FTA | Assists | Rebounds | Blocks | Steals | Turnovers |
Sacramento | 89 | 46.9 | 5-12 | 8-14 | 17 | 38 | 6 | 3 | 13 |
Miami | 88 | 37.8 | 12-34 | 14-18 | 19 | 46 | 4 | 8 | 17 |