Milwaukee, WI (SportsNetwork.com) - Khris Middleton beat the buzzer on a 3- point attempt that completed a late Milwaukee rally and lifted the Bucks to a dramatic 89-88 victory over the Miami Heat.

Middleton's game-winning shot, made possible by a jump-ball win from Jerryd Bayless and Zaza Pachulia's hustling offensive rebound and outlet pass, capped an 18-3 Milwaukee run over the final 6 1/2 minutes that enabled the Bucks to finally halt a season-high six-game losing streak.

The win was important in the standings as well, as Milwaukee increased its lead over the Heat for sixth place in the Eastern Conference to 2 1/2 games.

Middleton finished with 13 points and Ersan Ilyasova totaled 19 with 11 rebounds for the Bucks. Pachulia compiled 14 points, 11 boards and seven assists and Giannis Antetokounmpo also posted a double-double, collecting 16 points and 10 rebounds.

Dwyane Wade tallied 21 points in Miami's fifth consecutive road loss. Goran Dragic and Mario Chalmers scored 16 and 14, respectively.

The Heat managed a paltry nine fourth-quarter points and weren't able to close it out in the final stages. Wade missed the second of two foul shots with 17.5 seconds left to keep it a one-possession game at 88-85, and Bayless tied up Michael Beasley after Ilyasova's second free throw was off the mark to give the Bucks a chance to inch closer.

Bayless won the resulting jump but couldn't get a driving layup to fall. However, Pachulia saved the ball from going out of bounds and alertly heaved it to an open Middleton, whose 24-footer was dead on as time ran out.

"For the last two weeks we've been playing teams to one possession having the ball, but we've just been unlucky," Bucks head coach Jason Kidd. "Today the basketball gods were on our side and we got one to go in."

Milwaukee looked dead and buried after Wade's steal and dunk had the Heat up 85-71 with 6:33 remaining. Miami went scoreless over the next five-plus minutes, however, and Ilyasova and Middleton buried back-to-back treys to highlight a 14-0 run that got the Bucks back in it.

"They really started to impose the will of the game with their pressure and (by) really forcing us into some tough defensive possessions," Heat head coach Erik Spoelstra said. "That's sometimes how this game works, then things start to avalanche from there."

Pachulia finished off the stretch with an underneath layup that tied it at 85-85 with 1:20 to play. Wade answered by putting a loose ball off the glass to send Miami back in front entering the final minute.

The Heat closed out the first half strong to gain a 51-49 edge at the break, then dominated the final seven minutes of the third quarter to create some more separation.

Luol Deng and Chalmers each sank 3-pointers during a 9-2 run that extended Miami's lead to 67-57, and a Henry Walker trey with 1:15 left in the period sent the Heat into the fourth up comfortably at 79-65.

The Heat went 5-of-10 from beyond the arc for the third quarter, while the inefficient Bucks mustered just 16 points during the stanza despite pulling down 10 offensive rebounds.

Milwaukee also able to battle back from a double-digit deficit in the first half, trailing 32-22 early in the second quarter after Chalmers netted the last five points of a 9-0 Miami spurt. The Bucks later turned the tables with a 10-0 tear that had them ahead by a 41-36 count with under 4 1/2 minutes before the intermission.

Deng's triple and Dragic's 3-point play quickly restored the Heat's lead at 44-43, and they took a 51-49 advantage into the locker room following Beasley's tie-breaking jumper.

Game Notes

Heat center Hassan Whiteside sat out the entire second half due to a cut on his right hand he suffered midway through the second quarter. He had seven points and eight rebounds in 12 minutes before exiting ... Bucks guard O.J. Mayo returned to action after missing four straight games with a hamstring injury, but played just six minutes and went scoreless ... Miami's five-game road skid is its longest since an 11-game losing streak that overlapped the 2007-08 and '08-09 campaigns ... Milwaukee won all four meetings between the clubs this season, recording its first season sweep of the Heat since 1990-91