James' driving layup with 1:07 remaining in the extra frame gave him 36 points for the game and handed the Heat a 110-108 lead.
Wade (21 points) then secured the victory when he picked off an inbounds pass from the Magic's J.J. Redick with 9 seconds left and slammed it home.
Chris Bosh contributed 22 points on 10-of-15 shooting as Miami erased an 11-point, third-quarter deficit and snapped a two-game skid.
Orlando, meanwhile, fell to a sixth consecutive defeat despite 20 points and a franchise-record 29 rebounds from Nikola Vucevic.
Arron Afflalo led the Magic's scorers with 28 points and Redick canned five 3-pointers en route to 23 for Orlando.
2014: The Year in Music [PHOTOS]