Draymond Green made a layup with 0.9 seconds left to give the Golden State Warriors a 97-95 win over the Miami Heat on Wednesday.
Klay Thompson tied a season high with 27 points to lead the Warriors, who have won five straight.
LeBron James led Miami with 31 points as he reached the 20-point mark for the 25th consecutive game, the longest current streak in the NBA.
Jarrett Jack dribbled the ball at the top of the key for the Warriors as the clock ticked down before finding Green open underneath the basket. Green caught the pass in mid-air and made the basket.
James' jumper from the baseline banged off the rim giving Golden State the win as Miami lost for just the second time in 12 home games.
David Lee scored 22 points and grabbed 13 rebounds and Jack added 20 points off the bench for the Warriors.
Golden State took a 77-74 lead into the fourth quarter after leading for most of the third.
After hitting a 3 to tie the game at 87, James gave the Heat their first lead since early in the third with a turnaround 18-footer with 6:41 left for an 89-87 advantage.
The teams played a one-possession game over the next four minutes before Lee knocked down a pair of free throws to tie the game at 95 with 1:54 left.
The score was still tied at 95 with under a minute remaining. Ray Allen had a chance to give the Heat a lead with 45 seconds left. Lee followed by missing a driving layup. Shane Battier's miss from the corner with 12 seconds left gave the Warriors an opportunity in the closing seconds.
The Heat received a scare in the second quarter when Lee sent James to the floor with a flagrant foul sending James to the floor on his back.
James popped up quickly, but spent the next couple of minutes stretching out his right shoulder before knocking down the free throw and hitting a shot on the ensuing possession for a 47-43 lead.
Moments later, Dwyane Wade was poked in the eye by Thompson while trying to fight through a screen. With Wade's head down, Chris Bosh ran into Wade knocking him to a floor. After staying down on the floor, Wade eventually got to his feet and went to the locker room holding the back of his neck with 3:11 left in the half.
Thompson helped the Warriors take a 53-52 lead into halftime by scoring 21 points including five 3-pointers. Thompson scored 14 points in the second quarter, including 11 in a four-minute span.
Wade returned for the second half and opened the scoring with a dunk.
Both teams got off to a good start offensively, but it was defensive efforts by both teams which sparked the first highlight of the game.
After Stephen Curry picked off a pass by James, Wade returned the favor deflecting Curry's pass and ran toward the sideline saving the ball with an around-the-back pass to Mario Chalmers. Chalmers then found James, who tipped a pass to Wade for a layup and a 23-22 lead.
NOTES: Thompson has made at least five 3-pointers in three of his past five games. ... Prior to the game, Warriors head coach Mark Jackson said he believes Wade is the third-best shooting guard in NBA history behind Michael Jordan and Kobe Bryant. ... Curry had his career-best streak of eight consecutive games with at least 20 points snapped as he scored nine points.