Duke will face No. 2 Florida State next weekend in Charlotte, where the heavy underdog Blue Devils will go for their first ACC crown since 1989.
Duke led 24-15 in the third quarter but needed to rally to beat the rival Tar Heels (6-6, 4-4).
Marquise Williams ran for two scores and threw for another for UNC, which had won five straight.
Williams marched the Tar Heels to midfield on their final drive, breaking free from a collapsing pocket for a 10-yard run on fourth down to give UNC a shot. But Duke didn't let the Tar Heels get within Thomas Moore's field goal range, pressuring Williams as he threw a ball that sailed into Edwards' waiting arms.
The Blue Devils' sideline immediately started celebrating, though Duke needed Boone's final kneel down to close it out.
It was the latest big moment for Duke under sixth-year coach David Cutcliffe, who guided the Blue Devils to their first bowl game in 18 years last season. The Blue Devils are bowl eligible in consecutive seasons for the first time ever, though they certainly have a lot more to play for next week.
Duke, which beat UNC on Crowder's last-second touchdown catch in Durham last season, has defeated the Tar Heels in consecutive seasons for the first time since 1988-89. It was Duke's first win in Chapel Hill since 2003.
Edwards also had a 99-yard kickoff return for a touchdown for the Blue Devils, which came just before halftime after the Tar Heels had taken a 15-10 lead on Williams' 1-yard bootleg run for a score.
The Tar Heels dug their way out of a 1-5 start to become bowl eligible, but they'll certainly be left with memories of a few plays that let this game slip away. Among the biggest: Starting center Russell Bodine picked up an unsportsmanlike conduct penalty for shoving a Duke player after a play when the Tar Heels had reached the 9-yard line, pushing them back 15 yards and ultimately forcing them to settle for Moore's 37-yard field goal with 7:03 left.
That put UNC up only 25-24, and Martin's field goal gave the Blue Devils the lead for good.