The top-seeded Tar Heels (51-8) will face Virginia Tech at 1 p.m. on Sunday — about 11 hours after winning the longest game in ACC baseball 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.
Carlos Rodon threw 10 innings of one-hit ball with 14 strikeouts for the third-seeded Wolfpack (44-14).