Milwaukee out-scored Miami 21-6 down the stretch to halt the Heat's winning streak at four games.
Khris Middleton drilled a three-pointer with 13.5 seconds to play to pull Milwaukee within one, then superstar Giannis Antetokounmpo forced a jump ball and won it -- giving Holiday the chance for the game-winner.
"Just had to be aggressive and get something on the rim," Holiday said, adding that the key to the Bucks win was "persistence."
"We know it's a game of runs," he said. "When they went on a run, we knew we had one in us. From there we locked in and got key stops and came back and got a win."
Miami had no timeouts left, and Tyler Herro's desperation three-pointer at the buzzer was off-target.
Two-time NBA Most Valuable Player Antetokounmpo finished with 28 points 17 rebounds and five assists despite being in early foul trouble. Middleton added 26 points and Holiday scored 25 for Milwaukee.
Herro led the Heat with 30 points, Gabe Vincent scored 21 and Bam Adebayo added 18 points with 12 rebounds for Miami, who made 21 of their 44 three-point attempts.
The Heat remained 1 1/2 games ahead of the Chicago Bulls atop the Eastern Conference. The Bucks are in fourth place, a game behind the third-placed Philadelphia 76ers.
James Harden thrilled Philadelphia fans in his 76ers home debut, scoring 26 points with nine assists and nine rebounds in a 123-108 come-from-behind victory over the New York Knicks.
Joel Embiid scored 27 points and pulled down 12 rebounds and Tyrese Maxey scored 25 points for the 76ers, who improved to 3-0 with Harden, who arrived in a trade-deadline deal that sent Ben Simmons to the Brooklyn Nets.
For much of the night, it looked like the Knicks might spoil Harden's home Philly debut. The visitors, fueled by 16 points from eight Sixers turnovers, built a 16-point lead in the second quarter.
Philadelphia took the lead for the first time on Harden's free-throws in the third quarter, and his three-point play pushed the advantage to 13 points in the final minute of the period.
The Sixers didn't trail in the fourth, notching their fourth straight victory.
Maxey scored 21 of his 25 points in the second half, adding four rebounds and three assists.
"It was a movie," Harden said of his first game in front of Philadelphia fans, which started with a dramatic pre-game introduction.
"I felt the energy, I felt the love. I just wanted to come out there and show my love back," Harden said.
He had played a key role in two 76ers road wins, but said his first game in Philadelphia since joining the Sixers was "everything I expected it to be.
"I think everyone in the world knows how great these fans are, how passionate they are about these Sixers," Harden said. "It felt great to be out here. I tried to get the jitters out early, but it was fun out here. I'm glad we came out with the win."
Pacers out-last Magic
Elsewhere, Indiana's Malcolm Brogdon scored 31 points and grabbed 11 rebounds while handing out eight assists to help the Pacers overcome a 15-point fourth-quarter deficit in a 122-114 overtime win over the Magic in Orlando.
Tyrese Haliburton starred in overtime, scoring 12 of his 21 points in the extra session.
Brogdon, still regaining his form after a right Achilles tendon injury, scored 14 points in the fourth quarter.
He missed two shots in overtime, but Haliburton picked up the slack with five points in the extra session that included a three-pointer that gave the Pacers a three-point lead they wouldn't relinquish.
It went to overtime in Houston, too, where Donovan Mitchell scored 37 points and Mike Conley scored nine of his 15 in the extra session to power the Utah Jazz to a 132-127 victory over the Rockets.
Rudy Gobert added 27 points with 17 rebounds for Utah, who notched a third straight victory and their ninth in 10 games.