CLEVELAND (AP) -- 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."
Cavs guard Derrick Rose returned after missing more than two months with ankle injuries and scored nine points in 13 minutes.
Rose deepens Cleveland coach Tyronn Lue's rotation and the former league MVP gives the Cavs another proven scorer.
"I thought he looked pretty good," James said. "For as long as he's been out, can't ask for much. He gave us everything he had. Defensively he was in tune, offensively he made some great moves."
CAPTAIN, MY CAPTAIN
Before the game, James was chosen as one of the captains for this year's All-Star game after receiving the most votes in balloting by fans, players and media. James will have first choice from a pool of selected players, which will include former Cavs teammate Kyrie Irving and players from Western Conference teams.
James wouldn't reveal his No. 1 pick, but made it clear he's going to take his duties seriously.
"I'm going to try to build the best team I can," he said. "I don't play fantasy anything. And I don't trade guys onto teams when I play 2K or play the video games so this is different for me. But I know watching guys and loving their game and all that, if you had an opportunity to play with that guy, how special that would be."
Magic: Played without G Aaron Afflalo, suspended two games without pay by the NBA for fighting with Minnesota's Nemanja Bjelica on Tuesday. … Earlier this season, Orlando snapped a 17-game losing streak against Cleveland. … Vogel burned some early timeouts to scold his players after they gave up six 3-pointers in the opening minutes. …
Cavaliers: James will make his 14th straight All-Star start, one behind Kobe Bryant's record. … James set a goal to play 82 games, and Lue said that's a possibility although it's expected the four-time MVP will be rested for the playoffs. "He has to understand that his health is most important and without that we can't go very far," Lue said. "We just have to be smart about it."
Magic: At Boston on Sunday.
Cavaliers: Host Oklahoma City on Saturday.