Whiteside, playing with a thick bandage on his right hand to protect 13 stitches he got a week ago, tipped in Goran Dragic's miss after a wild final play over the game's final 11.3 seconds. James Johnson took the initial shot for Miami, Dragic muscled the rebound off the rim and Whiteside elevated over Andre Drummond for the winning tip.
The win was huge for Miami (36-38), which moved one game ahead of No. 9 Chicago and 2 1/2 games ahead of No. 10 Detroit for the final playoff spot in the Eastern Conference.
"Our guys want this so bad," Heat coach Erik Spoelstra said.
Dragic scored 28 points and Whiteside finished with 17 points and nine rebounds for the Heat.
Kentavious Caldwell-Pope had 25 points and Tobias Harris and Ish Smith each scored 19 for the Pistons (34-41). Detroit lost its fifth straight and eighth in nine games.
"That one hurts," Smith said. "It was a fun game to be a part of. Somebody had to lose it. I was hoping it wasn't going to be us, but it was. Kudos to them. They played hard. They played really hard."
The Pistons led 96-92 after Smith's jumper with 30 seconds left. Dragic hit a free throw after Detroit committed a sideline violation, then made a jumper to cut the deficit to one with 24 seconds left.
Miami forced a jump ball on the next possession, which was won by James Johnson. He advanced it to Dragic, who nearly lost it out of bounds. The final play went to James Johnson, whose 14-footer from the right wing missed, before the Heat found a way in the final moment.
James Johnson threw Whiteside over his shoulder in celebration as Heat players sprinted off the bench to join in.
"Hassan, maybe for the first time in his career, he is playing more for the guys next to him than he is for himself," Spoelstra said.
Miami wasted a 12-point second half lead and was up 78-69 going into the fourth quarter. Detroit's four-point lead in the final minute was the biggest edge the Pistons enjoyed all night, before the Heat scored the game's final five points.
"One tip away," Smith said.
Heat: G Dion Waiters (left ankle) was out again, and there is still no timetable for his return. ... The Heat and Pistons split the season series at two games apiece. ... It was Miami's final trip to The Palace of Auburn Hills. ... After an 11-30 start, Miami has now won 25 of its last 33 games.
Pistons: PG Reggie Jackson (rest) was inactive for the second straight game. He also missed the team's loss at New York on Monday. He was replaced in the starting lineup by Smith before missing the past two games. Coach Stan Van Gundy said Jackson is day-to-day. ... G Reggie Bullock (right foot) did not play.
Heat: At New York on Wednesday.
Pistons: Host Brooklyn on Thursday.