MIAMI (AP) Down by 16 at one point, trailing for the entire second half and staring squarely at what would have been a four-game losing streak, the Miami Heat were in serious trouble.
That is, until Dwyane Wade got a fortunate bounce that the Heat desperately needed.
Wade's jumper with 21.9 seconds left hit the front of the rim before falling to give Miami its only lead of the second half, and the Heat ended the game on an 11-0 run to rally past the Memphis Grizzlies 100-97 on Sunday night.
''Dwyane's uncanny,'' Heat coach Erik Spoelstra said. ''He can play absolutely horrible stretches of basketball and have the quickest memory, and all of a sudden get to the last 2 minutes and he has incredible confidence. ... Sometimes when you don't know where to go, that's always a great option, having a Hall of Famer.''
Chris Bosh led the Heat with 22 points, Gerald Green added 16 - three of them on free throws after Memphis' Matt Barnes fouled him behind the arc with 1:32 left - and Luol Deng scored 15 for Miami. The Heat trailed 75-59 late in the third quarter before coming back.
Wade got Miami within one on a drive with a minute left, then got the night's biggest shot to fall one possession later.
''I knew the ball's going to be in my hands ... and I was able to get a couple things to go,'' said Wade, who scored 14 for Miami.
After the game, he wrapped Grizzlies guard Mario Chalmers - the former Miami starter who made his return to the arena that he called home for his first seven full NBA seasons - in an embrace they both enjoyed.
Chalmers wasn't surprised at Wade's heroics.
''I'm used to seeing things like that,'' Chalmers said.
Jeff Green scored a season-high 26 points for Memphis, while surprise starter Barnes finished with 13 points and 13 rebounds.
Chalmers, playing against Miami as an opponent for the first time since being traded to Memphis last month, finished with 12 points for the Grizzlies - including a three-point play midway through the fourth to put his team up 89-79.
''We had a great chance to win,'' Memphis coach Dave Joerger said. ''We had all kinds of open shots but we didn't make them. We needed to make one shot in the final two and a half minutes. We didn't. They needed to score in about six straight possessions, and they did.''
The Grizzlies changed their lineup shortly before game time, ruling Tony Allen - who was originally listed as a starter - out with a right knee injury and inserting Barnes into the starting five to replace Zach Randolph. It was the first time Randolph played as a reserve since March 23, 2013.
Randolph and Marc Gasol each had 12 points for Memphis.
Grizzlies: Green has reached double digits in each of his last five games at Miami, hitting the 20-point mark in three of those. ... The Grizzlies had won three straight against Miami.
Heat: Tyler Johnson (shoulder strain) and Josh McRoberts (bone bruise in knee) remained sidelined and both will be evaluated again before Miami's game in Atlanta on Monday. Johnson said he plans to return no later than Wednesday in Brooklyn. ... Hassan Whiteside didn't record a blocked shot for the first time this season.
The win left Miami sixth in the Eastern Conference and ended a wild-seven day span in which the Heat visited plenty of spectrums in the standings. In the last week alone, Miami has finished days occupying the first, second, third, sixth and seventh spots in the East race.
Chalmers spent his first seven full NBA seasons with the Heat and was the starting point guard on the teams that won the 2012 and 2013 NBA championships. He received a pair of warm ovations from the crowd. As the Heat did for LeBron James last year, Chalmers' Miami highlight moments were put together in a tribute video shown on screens in the arena during a first-quarter stoppage in play. ''Feels like they still love me,'' Chalmers said.
Grizzlies: Host Washington on Monday.
Heat: Visit Atlanta on Monday.