GREENSBORO, N.C. -- Tyler Zeller had just enough time to catch Kendall Marshall's pass under the basket and put up a shot before the horn sounded.

The layup saved North Carolina (No. 7 ESPN/USA Today, No. 6 AP) from a shocking exit from the Atlantic Coast Conference tournament.

Marshall penetrated into the lane and found Zeller for the buzzer-beating basket as the Tar Heels rallied from 19 down in the second half to beat Miami 61-59 in Friday's quarterfinals.

The top-seeded Tar Heels (25-6) spent most of the day playing nothing like the team that had lost just twice since December, including a rousing win against rival Duke less than a week earlier to clinch the regular-season title outright. They threw away passes against Miami's zone, couldn't establish their big men in the lane and couldn't get out in transition for easy baskets to build momentum.

Yet a frantic rally in the final 8 minutes sent North Carolina on to Saturday's semifinals against Clemson.

"We feel as lucky as we can possibly be," coach Roy Williams said. "Those kinds of things happen in tournament time."

It was North Carolina's biggest comeback since rallying from 20 down in the first half to beat Georgia Tech in 2006 and its biggest second-half comeback since rallying from 21 down against Florida State in 1993. It is also believed to be the program's biggest comeback in any ACC tournament game.

"That's the thing about this team: We just keep fighting and fighting," sophomore John Henson said. "We came back good today, and that's what we do. I'm just glad we hit some shots."

Zeller came through twice for the Tar Heels in the final minute, first scoring on a hook shot against Reggie Johnson to tie it at 59 with 45.3 seconds left. Then, after a Miami turnover, Marshall penetrated past Julian Gamble and drew Johnson away from Zeller.

Marshall's pass found Zeller almost directly under the basket, and he quickly put it up as Durand Scott rotated down from the foul line in a last-ditch attempt to block the shot.