K.J. McDaniels scored 13 for the 76ers, who've won two straight for the first time all season. Jerami Grant and Robert Covington each had 11 for Philadelphia.
Dwyane Wade scored 17 of his 23 points in the first half for Miami, which was outscored 49-30 after halftime and plays host to LeBron James and Cleveland on Thursday in a Christmas Day showdown.
And this was anything but the way the Heat wanted to go into that one.
Shawne Williams scored 17 and Mario Chalmers added 11 for the Heat, who missed four 3-pointers that would have given them the lead in the final minute.
Miami also turned the ball over 22 times, helping Philadelphia score 21 points.
Miami led by 13 after the opening quarter, by 15 at intermission and pushed the lead to 69-46 - a 23-point cushion - midway through the third quarter.
Someone forgot to tell the 76ers that the game was over.
From there, they went on a staggering 41-13 run over the next 16 minutes.
A team that hadn't successfully overcome any more than an 11-point deficit all season - and has been universally mocked for allowing the losses to pile up with alarming regularity - absolutely turned everything around without warning. Carter-Williams made a 3-pointer with one-tenth of a second left in the third to get Philadelphia within 78-73, and the 76ers' run didn't end there.
McDaniels followed up a miss with a one-handed dunk and rim hang for emphasis with 7:22 left, getting Philadelphia within 82-80. He wanted a dunk on the next possession after a Miami turnover, but the alley-oop pass went awry.
No matter: Philadelphia simply tied it on the next possession on a drive by Mbah a Moute, then took the lead when Grant scored while getting fouled with 5:55 left. A pair of free throws by Robert Covington not long afterward put the 76ers up 87-82, completing the run.
76ers: Before the game, the 76ers announced the signing of F Malcolm Thomas, who played five games in Philadelphia before being waived last month. Ronny Turiaf was waived to accommodate the Thomas signing. ... Philadelphia blocked 10 of Mami's 21 missed shots in the first half, making the 76ers the third team this season to have that many blocks in a half (joining Oklahoma City and Milwaukee). ... The 76ers have now won two straight in Miami after losing 13 in a row there.
Heat: Centers Chris Bosh (strained calf) and Justin Hamilton (concussion) were sidelined, Bosh for the sixth straight game. He's done some shooting but the Heat aren't certain if he'll be ready for Thursday against Cleveland. ... Miami hasn't won two straight since Nov. 22-23, and hasn't won two straight at home since Oct. 29-Nov. 2. ... Wade started the night 65th on the all-time NBA scoring list. He moved to 62nd on Tuesday, passing Lou Hudson, Calvin Murphy and World B. Free.
(Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)