James came off the bench late in the fourth quarter after nursing painful leg cramps and knocked down the go-ahead 3-point shot with 2:51 to play that put the Heat up 3-1 in the series, an advantage no team has ever overcome in the history of the NBA finals.
Miami can wrap up the series Thursday by winning Game 5 in Miami.
Dwyane Wade and Mario Chalmers both scored 25 points for the Heat. Miami shot 48.1 percent from the field and made 18-of-25 free throws.
Russell Westbrook poured in 43 points to lead the Thunder, going 20-of-32 shots from the field. Westbrook picked up only three points from the free throw line and was 0-for-3 from 3-point range.
Kevin Durant had 28 points but was the only Thunder player other than Westbrook to score double figures.
Oklahoma City led 33-19 at the end of the first quarter. The Heat reversed the momentum in the second quarter, outscoring the Thunder 27-16 and then held the visitors off in the fourth quarter, with James' 25-foot jumper breaking a 94-94 tie and giving Miami the lead for good.