Updated

Roy Williams was mostly focused on his North Carolina team after getting beat by UAB and coach Jerod Haase.

Williams watched his 16th-ranked Tar Heels get outrebounded badly, struggle from the perimeter and fall 63-59 to the Blazers on Sunday. That was enough to occupy his mind, but not to wipe out the pride he felt for his protege.

"It was hard at the end of the game, and it was hard for me," said Williams, Haase's former coach and boss. "I love my team. I told them before the game, right now I love my team more than I love him, but right now I've got to feel some pride in what he's doing, and I've got to feel some sadness for what we're doing and what we did today."

Williams agreed to visit UAB (6-2) in exchange for two home games for the Tar Heels (4-2).

Charlotte native Chad Frazier scored 25 points and the Blazers made three free throws over the final 6.6 seconds to preserve the upset for their first win over a ranked team in four years.

"This is the definition of bittersweet," said Haase, in his second year at UAB. "It's a big win for us. I was proud of our guys, but for coach Williams to come here and bring North Carolina, that's pretty special.

"I hated having to go shake his hand, but it's a special deal," Haase added.

It didn't come easily.

Jordan Swing hit two free throws and Robert Williams made 1 of 2 to help the Blazers hold on after losing most of a 14-point second half lead.

Marcus Paige missed two contested 3-pointers in one late possession and the Tar Heels fouled Swing, who gave the Blazers a 62-57 lead.

Brice Johnson drove for a quick basket but Williams effectively put the game away when he made the second of two free throw attempts.

The Tar Heels were coming off a win over No. 9 Louisville to end the defending champions' 21-game winning streak, but Roy Williams couldn't beat his protege this time

Haase played for Williams at Kansas and spent 13 years on his staff for his alma mater and the Tar Heels. His old boss called him "one of the Top-5 competitors I've ever coached."

"Jerod Haase is one of the nicest young men I've ever known in my life and he's one of the best competitors I've ever known in my life," Roy Williams said. "He had his team competing a heck of a lot harder today than I got my team competing."

It was UAB's first win over a ranked team since beating No. 20 Butler in 2009, and it came against one of college basketball's most storied programs.

J.P. Tokoto led North Carolina with a career-high 16 points on 7-of-11 shooting. Paige had 13 points but made just 6 of 16 shots and missed all six 3-point attempts after scoring a career-high 32 against Louisville.

Nobody else picked up the slack in perimeter shooting for the Tar Heels, who made 1 of 12 attempts from beyond the arc.

The Blazers, who lead the nation in total rebounds, dominated the boards 52-37 to overcome shooting troubles. They made just 19 of 62 shots (30.6 percent) but collected 21 offensive rebounds.

"I just felt like they seemed to get every loose ball and so many second-shot opportunities," Roy Williams said. "They shot 30.6 percent and still won the game because of the rebounding battle. To me, it's the most important factor in the game of basketball."

Frazier made 12 of 14 free throws and hit three 3-pointers in five attempts for UAB.

"Everybody from back home is texting me right now," he said, sporting a Bobcats T-shirt. "It feels good to get the win. I always dreamed about playing Carolina."

Rod Rucker added 11 points while Fahro Alihodzic had 13 rebounds and eight points.

UAB also made 22 of 28 from the line.

UAB led 39-25 early in the second half before a long field goal drought helped North Carolina come back.

"We knew they were going to come back," Haase said. "I told the guys at halftime that I'd been in that locker room too many times. I knew they were going to come out fighting and scrapping and clawing, and our guys did the same thing."