The Pistons (10-3) also won for the eighth time in nine games, continuing a torrid start that has them among the NBA's biggest pleasant surprises early in the season.
Avery Bradley scored 24 points, Reggie Jackson had 17 points, rookie Luke Kennard broke free for nine of his career-high 14 points in the fourth quarter, backup point guard Ish Smith finished with 11 points and Andre Drummond added 17 rebounds for Detroit.
Hassan Whiteside had 20 points and 12 rebounds and Goran Dragic scored 18 points for Miami (6-7), which finished a six-game road trip with a 3-3 record.
Miami led 58-55 at halftime and then started strong in the third quarter, taking a 73-62 lead with 7:03 remaining in the quarter.
The Pistons answered, going on a 17-5 run to take a 79-78 lead with 2:40 left in the third quarter.
Detroit took an 83-81 lead into the fourth quarter and then went up 93-86 with 9:17 remaining thanks to 10 consecutive points from bench players.
Miami cut Detroit's lead back to one at 93-92 with 7:55 left in the game, but the Pistons countered with a 13-2 run to take a 105-94 lead with 3:58 remaining.
The Heat attempted 37 shots from 3-point range, making 13 (35.1 percent).
The Pistons shot 48.3 percent from the floor overall (42 of 87) and 50 percent from 3-point range (14 of 28), and they outrebounded the Heat 54-39.
NOTES: The Pistons played without F Jon Leuer (left ankle sprain) and F Stanley Johnson (strained right hip flexor). ... The game was a homecoming for rookie Heat G Derrick Walton Jr., who grew up in suburban Detroit and played at Michigan. ... The 9-3 start for Detroit through 12 games marked its best start since the 2005-06 season when they were 10-2. ... Miami played an Eastern Conference opponent on the road for the first time since a season-opening loss at Orlando on Oct. 18. ... The 11 road games in November for the Heat are the most on the road the team has ever played in November. ... Pistons C Andre Drummond became the third player in 40 years to grab 12 rebounds or more in the first 12 games of the season. Moses Malone in 1978-79 and Kevin Love in 2011-12 were the others. ... In Friday's 84-74 win at Utah, the Heat held the Jazz to four field goals in the second half, the fewest allowed in a half in team history. ... This was the first of four meetings of the season between the Pistons and Heat. The teams next play Jan. 3 in Miami.