The top-seeded Tar Heels (51-8) will face Virginia Tech at 1 p.m. Sunday — nearly 11 hours after winning the longest game in ACC Tournament history.
Landon Lassiter walked to start the 18th, moved to second when Colin Moran was hit by a pitch from Chris Overman (1-1) and advanced to third on Skye Bolt's bunt.
Stubbs then singled to short left field off Will Gilbert to bring home Lassiter.
Chris Munnelly (6-0) gave up a leadoff double to Brett Williams before getting two popouts and a groundout to end it at 1:52 a.m. ET.
Carlos Rodon threw 10 innings of one-hit ball with 14 strikeouts for third-seeded N.C. State (44-14).