A costly blunder by J.R. Smith and a disputed foul call involving James himself sure helped.

Stephen Curry scored 29 points and the Warriors capitalized on Smith’s mistake that sent the game into overtime, overcoming a 51-point performance by James to beat Cleveland 124-114 in Game 1 on Thursday night.

The game nearly over, James jawed with both Curry and Klay Thompson, then Tristan Thompson and Draymond Green tangled moments later and made contact. After replay review, Tristan Thompson received a Flagrant 2 foul and ejection with 2.6 seconds left.

James was in utter disbelief as regulation ended stunningly: George Hill made the first of two free throws with 4.7 seconds left after being fouled by Klay Thompson, but when Smith secured the rebound of the second, he dribbled back toward halfcourt instead of shooting, apparently thinking the Cavs had a lead.

“He thought it was over. He thought we were up one,” coach Tyronn Lue said.

Yet Smith insisted he knew the score. Green figured Smith was simply looking for James, saying, “I would have looked for LeBron, too.”

“I just thought we were going to call a timeout. Because I got the rebound, I’m pretty sure I couldn’t shoot it over KD,” Smith said of Kevin Durant. “If I thought we were ahead, I would have just held on to the ball so they could foul me. Clearly that wasn’t the case.”

Instead, OT.

And why not? Both these teams were pushed to their limits in seven-game conference finals they each had to win on the road.

“I can’t talk about a situation that way because I do some dumb stuff on the court,” Durant said of how the fourth quarter finished. “I don’t know what was going through J.R.’s head. He made a great rebound and gave them an opportunity to win the basketball game.”

Game 2 is Sunday night back at Oracle Arena, where the Warriors have won 18 of their last 19 postseason games. In 2015, when the Golden State beat the Cavs to capture the franchise’s first title in 40 years, the first two games of the series went to OT — Golden State winning the opener and Cleveland Game 2.

James shot 19 for 32 to go with eight assists and eight rebounds in the opener of his eighth straight NBA Finals and ninth overall, as well as Cavs-Warriors Take IV. James notched his eighth 40-point game during this playoff run to tie Hall of Famer Jerry West’s feat in 1965 for most in a single postseason.

“We’ve got to move on,” James said. “This game is over and done with. We had opportunities.”

James drove past Curry for a three-point play with 50 seconds remaining in the fourth. But James was given a foul following a review with 36.4 seconds left and Durant converted a pair of free throws to tie it at 104.

The call had initially been a charge on 2017 finals MVP Durant and James protested the change — while KD said afterward he thought it was the right decision because “I knew he was late on the drive and I knew I had my man beat and he came over a little late.”

James called it a “huge play” and said “I knew I was outside the charge line.”

“I read that play as well as I’ve read any play in my career, maybe in my life,” James said.

Rules allow officials to go to replay in the final 2 minutes of regulation or in overtime to determine if a defender attempting to draw a charge was in the restricted area. When doing so, they can view if the defender was in a legal guarding position. They decided James wasn’t and changed their original call.

Lue was disgusted to lose this way, saying of the overturned call: “It’s never been done, ever in the history of the game. And then tonight in the finals on the biggest stage, when our team played well, played our (butt) off, man, it ain’t right.”

Lue added that the way James played, “to come up robbed, it’s just not right.”

Durant struggled to find his stroke but wound up with 26 points on 8-for-22 shooting and nine rebounds.

Golden State got a serious scare when Thompson went down after Smith slid hard into the Splash Brother’s left leg at the 6:17 mark of the first quarter. Thompson lay grimacing in pain then went to the locker room with what was called a bruised left leg that needed re-taping. He returned for the start of the second quarter to huge roars from the yellow-clad sellout crowd and scored 24 points. He and Curry each connected on five 3s.

Curry drained one of those way-out-there 3-pointers that have been hard to come by this postseason to beat the halftime buzzer and Golden State shot 13 for 36 from deep.

Kevin Love returned from a concussion to provide a big boost for Cleveland with 21 points and 13 rebounds.

The Warriors missed the defensive presence of 2015 NBA Finals MVP Andre Iguodala, who was out for a fifth straight postseason game dealing with a bone bruise in his left knee. He is scheduled to be re-evaluated ahead of Game 2.

Everybody expects another wild one with so much talent on both sides.

“It was a crazy game,” Curry said. ”... The finals, man, anything is liable to happen.”

TIP-INS

Cavaliers: James has 109 career 30-point games in the playoffs, tying Michael Jordan for most ever. ... Cleveland held a 19-4 advantage on the offensive glass, getting seven offensive rebounds in the first half to the Warriors’ none. ... James’ first quarter: 4 for 4 with a 3-pointer, 12 points, three assists, a steal and turnover.

Warriors: Curry’s early three-point play gave him the free throw he needed for 379 to pass Rick Barry (378) for first place on the Warriors’ career list. ... With his 293rd career 3 in the playoffs, made in the second quarter, Thompson passed Kobe Bryant (292) for sixth place on the NBA’s list for postseason 3s. ... Kevon Looney started again in place of Iguodala, but coach Steve Kerr went to McGee after the break. ... Home run king Barry Bonds was in attendance.