The Heat were ahead by two points and had a chance to win it with 0.6 seconds remaining and Dwyane Wade at the foul line.
Wade missed the first shot and tried to intentionally miss the second in hopes of giving the Heat a chance to put the contest away with a basket.
But rather than bouncing the second foul shot off the rim, he missed the hoop completely, resulting in a violation and a turnover.
That gave the Celtics the ball at mid-court.
Gerald Wallace found Green in the right corner with a cross-court pass and Green launched the shot just before the buzzer despite being guarded tightly.
The shot went in, giving Boston a stunning win.
Green finished with 24 points and Avery Bradley added 17 for the Celtics.
LeBron James provided 25 points, 10 assists and eight rebounds for the two-time defending NBA champions.
Chris Bosh helped out with 20 points and seven rebounds.
2014: NFL Cheerleaders [PHOTOS]
UPI horse racing weekend preview