CHARLOTTE, N.C. — The hip-hop music blared. The ice flew.

This was one happy visitor’s locker room after point guard Emmanuel Mudiay and unlikely center Luke Kornet rallied the Knicks from an awful first half, during which they trailed by 21 points. The Knicks went on to stun Charlotte, 126-124, in overtime Friday night at Spectrum Center to break a five-game losing streak.

Mudiay was flawless after halftime, scoring 29 of his career-high 34 points. Kornet, playing major minutes after rookie center Mitchell Robinson went down with an ankle sprain, struck for a stunning 13 points, three blocks and six rebounds, and was a plus-18 in 24 flawless minutes — all coming in the second half and OT. He was 3-of-5 from 3-point land.

Kornet hadn’t made a 3-pointer this season and his surge kept Enes Kanter on the bench. Afterward, Mudiay and Kornet received ice baths from their jubilant teammates.

“It was cold, too,’’ Mudiay said.

Overtime began with back-to-back 3-point baskets by Tim Hardaway Jr. and Kornet, and the Knicks never lost that lead.

Coach David Fizdale came to the postgame press conference, shrugged his shoulders and said before being asked: “I don’t know when they’re going to show up.”

“I love these kids,’’ Fizdale added. “They never cease to amaze me in both ways. Trust me. They do some stuff where I go, ‘What are they doing?’ And they do stuff like this where they don’t quit.”

Mudiay, who has been starting at point guard for the past month, was brilliant, hitting 14-of-21 shots and dishing out eight assists. He, too, was playing major time because Frank Ntilikina suffered a mild ankle sprain in the third quarter and joined Robinson on the shelf.

“It says a lot about this team,’’ said Mudiay, who severely outplayed Hornets free-agent-to-be Kemba Walker in the second half. “We work so hard. We don’t want to just go out there and quit. Just keep pushing and chopping at the tree. I just wanted to win so bad. I knew Frank went out. I think when he went out i had to be more aggressive.’’

Charlotte mashed the Knicks early, taking a 33-16 lead after one and a 72-53 bulge at halftime with a pass-happy offense. During Fizdale’s second timeout to try to stop the bleeding, he wrote “selfish” on the grease board, according to Mudiay.

“He was telling the truth,’’ Mudiay said of Fizdale, who switched to a zone defense in the second half.

Friday’s clincher came on an inbounds play, when Kevin Knox found Mudiay cutting for an easy layup and a five-point lead with 17 seconds left.

“A great win for us,’’ said Knox, who struck for 20 points, 17 in the first half.

With Mudiay and Kornet spearheading a fourth-quarter surge, the Knicks erased a 15-point deficit after three quarters and forced overtime.

“I have a lot of confidence in Mudiay,’’ Fizdale said. “He continues to get better and better.’’

The bigger surprise was Kornet, who was a candidate to be cut Thursday to make way for Allonzo Trier’s new roster status. Instead, the Knicks released Ron Baker, and Kornet, who played 10 games in the G-League, keyed a win.

“It’s a testament to our player development,’’ Fizdale said. “Coach [Mike] Miller in the G-League and Luke’s work ethic. He hadn’t been called on a lot this year and he’s kept himself mentally ready. I haven’t even given him a real shot yet. So right when I got here, when I got the job I was immediately working him out. I said I like this kid, he’s got something different than our other big guys.’’

Mudiay was as happy for his ice-bath companion as for himself.

“He’s one of our hardest workers,’’ Mudiay said. “He knows the game like crazy — one of our smartest players, too. For him to come out like that, he doesn’t surprise people like us. We see it in practice but do it in front of everybody meant a lot to me. I’m so happy for him.’’

At the 30-game mark, the Knicks moved to 9-21. But the win was in danger until the final tick. Knox missed two free throws with five seconds left and the Knicks up two. Walker (16 points) got the rebound and raced all the way upcourt, missing a running layup at the buzzer as the Knicks swarmed him — with Kornet’s long arms one of the distractions.

“I had an opportunity to get my legs under me,’’ said Kornet, 0-for-4 on 3-pointers entering the game. “I started feeling my shot. Honestly, everyone was playing really good team basketball. That’s what I thrive on when the ball was moving and nobody cares who’s getting the shot. When in that zone as team, your individual performance takes care of itself.”

As Kornet held court with the media after the win, Hardaway bellowed from across the room, “Yeah, Luke!”

Yeah, indeed.