CLEVELAND — There was none of the usual postgame chatter or music in the Cavaliers’ locker room.

The mood was somber and quiet, not the same place.

“Right now we’re in Strugglesville,” LeBron James said. “But it felt like a win. We needed it. Definitely.”

Isaiah Thomas made two free throws with 11 seconds left and Cleveland came up with a defensive stop in the frantic final seconds after blowing a 23-point lead to beat the Orlando Magic 104-103 on Thursday night and snap a four-game losing streak.

After Thomas made his shots, Orlando’s Elfrid Payton missed a contested layup with three seconds left. The three officials ruled there was an inadvertent whistle and held a jump ball at midcourt.

Magic forward Aaron Gordon grabbed the toss and sank a 45-footer as the horn sounded and Cleveland’s crowd shrieked in disbelief. But Gordon committed a jump-ball violation with the move and Cleveland only had to inbound the ball to come away with a victory following a crazy and exhausting final sequence that left everyone dazed.

“No, I don’t,” said Thomas when asked if he knew what happened. “It was a lot of back and forth. I’m just glad we just came out with the win.”

James committed six turnovers and went 2 of 8 from the free-throw line but closed in on 30,000 career points, Thomas scored 21 and came through in crunch time and the Cavs got their fourth win in 13 games.

However, some of the same problems – defensive lapses, stagnant offense – that have plagued the Cavs for much of the season resurfaced in the second half, when Orlando outscored Cleveland 56-37.

“Obviously we know we’ve been struggling as of late,” James said. “We’re just trying to figure out how we can put two halves together. Obviously we had a great first half on Monday (against Golden State), great first half today and the same result. So we’ve got to keep pushing, keep watching film and seeing ways we can be better.”

James scored 16 and now needs 25 to become the seventh player in NBA history to reach 30,000. He’ll likely reach the plateau on Saturday when Cleveland hosts Oklahoma City.

The Cavs were rolling to a rare, easy win before they went cold from the outside and were outscored 33-17 in the third quarter by the Magic, who have dropped 17 of 19. Cleveland went 1 for 17 on 3-pointers in the second half.

Payton scored 19 and Gordon 17 for Orlando, which felt a few calls should have gone their way in the final seconds.

Thomas was sent to the line with 11 seconds left when referee Kane Fitzgerald called a foul on Orlando’s Shelvin Mack. Magic Coach Frank Vogel felt Mack had tied up Thomas to force a jump ball.

“I’m disappointed for our guys,” Vogel said. “I felt like they deserved the victory. We didn’t get the breaks down the stretch.”

NOTES

ALL-STAR GAME: LeBron James and Stephen Curry will go head-to-head again, this time as captains who pick teams for the revamped NBA All-Star Game.

James and Curry received the most votes from fans in their conferences Thursday night and will draft from a pool of the rest of the NBA’s best for the Feb. 18 game in Los Angeles.

“Captain huh? Really Appreciate all the votes from the fans, media and players!” Curry wrote on Twitter .

James will pick first as the player who received the most fan votes. He will make his 14th All-Star Game start, one behind Kobe Bryant for the most in league history.

“Congrats Captain ,” Kevin Love wrote to his Cleveland teammate James on Instagram.

He could start his team with Kevin Durant, who teamed with Curry to beat James and the Cavaliers in the NBA Finals. Or maybe he could go with Kyrie Irving, a former All-Star Game MVP who asked to be traded away from Cleveland last summer and has led Boston to the best record in the East.

Perhaps it will be Milwaukee’s Giannis Antetokounmpo, whom James came from behind to edge with 2.6 million votes. The Greek Freak had a little more than 2.5 million.

The format was changed from the traditional East vs. West matchup for the first time after lackluster games the last two seasons, when players made little attempt to defend and the West nearly scored 200 points in both of its victories.

Both James and Curry will make their first four picks from the pool of starters, but they don’t have to stick to conference affiliation in choosing their rosters.

The other starters from the Eastern Conference will be Toronto’s DeMar DeRozan and Philadelphia’s Joel Embiid, the only first-time All-Star among the starters.

New Orleans also has two starters in Anthony Davis and DeMarcus Cousins. Houston guard James Harden, the NBA’s scoring leader, rounds out the starters, who were selected by a combination of fan, media and player voting. Fan balloting accounted for 50 percent of the formula, with the media panel and player vote each making up 25 percent.

The seven reserves in each conference, voted upon by the head coaches in each conference, will be announced Tuesday, and the rosters selected by James and Curry will be unveiled next Thursday.

The league does not plan to televise the draft.

BULLS: Guard Kris Dunn is out indefinitely after being placed into the NBA’s concussion protocol following a fall during a game that ended up with him dislocating two front teeth.

The Bulls said Dunn’s two teeth have been splinted with braces. He was re-evaluated for concussion symptom and will not travel with the team to Atlanta for Saturday’s game.

Dunn was injured Wednesday night during a home loss to Golden State. He made a fast-break dunk with 2:55 left, but landed awkwardly on the play and his face slammed into the floor.

MAGIC: Aaron Afflalo was suspended two games without pay by the NBA for fighting with Minnesota’s Nemanja Bjelica.

Afflalo punched Bjelica in the head in the fight that took place with 7:28 left in the second quarter of the Magic’s 108-102 victory Tuesday night.