Jerryd Bayless contributed 11 of his 15 points in the fourth quarter for Milwaukee, which won its third straight meeting with the Heat.
Giannis Antetokounmpo, who was named to the dunk contest prior to the game, finished with 13 points, six rebounds and four assists, and O.J. Mayo gave 14 points off the bench.
Milwaukee's reserves outscored Miami's, 54-13.
All five Miami starters had at least 12 points, with Chris Bosh's 26 leading the way in the loss. Mario Chalmers had 21 points and eight assists and Hassan Whiteside followed up his first career triple-double with 16 points and 16 rebounds.
Milwaukee pulled away in the fourth quarter behind Bayless, whose personal 7-0 run that spanned a pair of Heat timeouts just about put the game out of reach. His jumper at 3:33 made it 102-91, and the Bucks held on from there despite shooting 3-for-6 from the line in the final minute.
The Heat took their biggest lead of the game on a Norris Cole 3-pointer at 3:54 of the third. That made it 78-68, but Milwaukee countered with the next eight points on three straight possessions.
Earlier, neither team led by more than five until a 7-0 run gave the Bucks a 45-35 lead midway through the second quarter. Miami got back within one on two different occasions, but Milwaukee owned a 54-50 halftime advantage.
There were 16 lead changes and 10 ties ... Danny Granger started in place of Deng and netted 14 points ... The Bucks shot 54.9 percent (39-for-71) and 9- of-16 from behind the arc.