Whiteside’s ninth rebound Tuesday night may have been the biggest of his career as he tapped in a loose ball from Goran Dragic’s shot off the iron as the buzzer sounded lifting the Miami Heat to a 97-96 victory over the desperate — and now despondent — Detroit Pistons.

The last player to hit a shot as time expired to win a Heat game: LeBron James in Game 1 of the Eastern Conference finals against Indiana.

“I was like, ‘whatever happens, I’m going to chase this rebound like it’s our last’,” Whiteside said afterward. “I just tried to get a hand on it any way I could.”

Whiteside’s big tap with his left hand — the one which isn’t stitched and bandaged up because of 13 stitches — may help get Miami into the postseason.

“It was a split second,” Whiteside said. “I didn’t know the time, I just knew we needed the win. We’re mentally tough, have been in so many close battles like this ... we didn’t put our heads down, we kept grinding.”

Said coach Erik Spoelstra: “It was high-level competition ... both teams. It felt like a playoff game because of how desperate the situation was. As a fan, a coach or a player, you really had to admire and respect the level of intensity that was out there.”

The victory allowed the Heat’s run toward a potential postseason berth continue as Detroit’s hopes keep fading in a game which could have huge implications in deciding which team makes the postseason.

Miami was playing its final game in The Palace of Auburn Hills and it doesn’t look like the Pistons’ soon-to-be-former arena, the one which housed the 1989 NBA champs in its inaugural year, will host any more playoff contests before closing.

With the victory, Miami – which holds the final playoff spot in the Eastern Conference – extended its lead on 10th-place Detroit to 2 ½ games.

The Heat increased its lead on No. 9 Chicago to a full game.

Miami had lost three of four coming in and needed this one — although perhaps not as badly as Detroit did.

Before the game, Detroit coach Stan Van Gundy said it was imperative his team not lose again.

Related stories from Miami Herald

“It is not the end of the road,” Van Gundy said, “but you can see the end of the road from there if we don’t get it done.”

The Pistons almost did get it done.

The Heat led by nine going into the fourth yet watched the Pistons come all the way back — and then some.

Detroit led by four with 30.1 seconds remaining yet couldn’t hold the lead.

Dragic (28 points) hit a free throw, then cut the lead to one with 24.5 seconds left on a shot from six-feet out.

In the final possession, James Johnson missed the initial shot with Dragic getting it back and throwing up a desperation heave from inside 10 feet.

The ball bounded off the rim and Whiteside went up and tapped it in for the win.

“I just tried to get the ball and when I did, I remember there were a lot of hands out there,” Dragic said.

“It was like a jump ball. I just heaved the ball off, shot it. Luckily [Whiteside] was there.”

Detroit, which has lost eight of nine since drawing to .500 after beating the Knicks earlier this month, trailed for much of the game before a strong surge in the final period.

The Pistons cut Miami’s lead to two with 4:54 left on a corner 3 from Kentavious Caldwell-Pope before taking the lead 20 seconds later on Andre Dummond’s dunk off a rebound and consequent free throw.

With 45 seconds left in a tie game, Caldwell-Pope hit a long jumper to give the Pistons a lead they almost did not surrender.

“They made it tough on us in the fourth,” Spoelstra said.

“Our guys really wanted this, really care about one another. They love each other and want to play well for each other. It’s bigger than just themselves.”

Wednesday: Heat at Knicks

When, where: 7:30 p.m.; Madison Square Garden, New York.

TV/radio: SUN; WAXY 790, WAQI 710.

Series: New York leads 61-52.

Scouting report: Wednesday's game kicks off a home-and-home between the two with the season series finale Friday in Miami. The Knicks snapped a five-game slide by beating Detroit on Monday thanks in part to 27 points from Derrick Rose and 21 from Carmelo Anthony. Neither player are listed as starters by the Knicks for Wednesday's game.

Hassan Whiteside #21 of the Miami Heat celebrates his buzzer beating game winning basket with teammates in front of Andre Drummond #0 of the Detroit Pistons at the Palace of Auburn Hills on March 28, 2017 in Auburn Hills, Michigan. Gregory ShamusGetty Images

Never miss a local story.

Sign up today for a free 30 day free trial of unlimited digital access.