Mikaela Ruef scored a career-high 17 points on the way to regional MVP honors, Amber Orrange added 14 and Bonnie Samuelson knocked down three 3-pointers for 13 points off the bench for Stanford (34-3), which had its streak of five straight Final Fours snapped last March.
North Carolina got the ball back with 49 seconds left after an offensive foul on Ruef but Xylina McDaniel missed a lay-in on the left side and Ruef secured the rebound. Samuelson converted two free throws with 21.1 to go.
When Orrange drove for a left-handed lay-in with 9.6 seconds remaining, Ogwumike went to her knees and pumped her arms. Stanford protected its unbeaten home record with one last memorable win to send Ogwumike, Ruef and the seniors out in style.
Samuelson's third 3-pointer of the game capped a 15-2 Stanford run with 13:09 to play that put the Cardinal ahead 48-42 before Danielle Butts' basket ended a 5 1/2-minute scoring drought for North Carolina.
Diamond DeShields was limited to 13 points on 5 for 15 shooting for North Carolina, missing all but one of her six 3-point tries.
DeShields played with no signs of injury after the freshman star sprained her right ankle and tweaked her left knee during a semifinal win against South Carolina on Sunday night, then underwent treatment leading up to the game.
She said they'd have to strap her down to keep her off the court for this game.
Ogwumike's lay-in pulled Stanford within 42-41 with 16:09 left, then she drew a foul on Stephanie Mavunga for pushing off moments later and scored again to give the Cardinal their first lead since the opening minute and send the near-capacity crowd into a frenzy.
North Carolina connected on five of its first six 3-point attempts and Gray knocked down three 3s in a span of 1:42. After Brittany Rountree's 3 at 12:45 put UNC ahead 22-9, Stanford responded with an 8-0 run and pulled within 36-30 at halftime despite four early turnovers.
The Tar Heels made 7 of 13 first-half 3s, accounting for half of their made field goals.
McDaniel pushed Ogwumike in the paint and both picked up two early fouls and had to spend time on the bench.
Stanford freshman Lili Thompson, who shut down Penn State star Maggie Lucas in the semis, drew a second foul on DeShields with 9:34 left in the first half but the North Carolina star played 19 of 20 minutes.
Stanford hasn't won a national title since 1992. The Cardinal have had their chances, losing to Tennessee in the 2008 championship game and to Connecticut for the 2010 title. Stanford also lost to UConn in the 2009 national semifinals, to Texas A&M in the 2011 semifs and Baylor in the same round the following year.