Davis threw for 376 yards and two touchdowns for the Pirates (4-2), who survived a thrilling finish with their instate rival in front of a sellout and record home crowd. East Carolina ran out to a 21-0 first-quarter lead only to see the Wolfpack rally to take the lead late in the fourth quarter on a field goal from Josh Czajkowski before staging its own comeback.
Michael Barbour's field goal with 1:04 left sent the game into overtime, where Davis put the Pirates ahead for good by bouncing off a pile of tacklers on a sneak and falling across the goal line.
The Wolfpack (5-2) couldn't answer, with Wilson forcing a pass over the middle to Jarvis Williams that Magazu grabbed at the goal line.
Almost immediately, the East Carolina sideline spilled onto the field to celebrate in front of the roaring home crowd in the newly finished end zone section of Dowdy-Ficklen Stadium.
It was quite a finish for the Pirates considering the game appeared to be slipping away only moments earlier. East Carolina committed countless mistakes, from 10 penalties to a pair of costly fumbles that both set up a touchdown for the Wolfpack and ended another drive just as the Pirates were crossing the goal line.
And yet, the Pirates figured out a way to beat N.C. State, a team that had won seven of 10 matchups with the state's four other Bowl Subdivision opponents under coach Tom O'Brien. That included two meetings with the Pirates.
Lance Lewis and Justin Jones had touchdown catches for the Pirates, while Jon Williams had a 5-yard TD run to cap East Carolina's first possession. The Pirates finished with 496 total yards, while their struggling defense hung in against Wilson and the Wolfpack's strong passing game.
Wilson threw for 322 yards and one touchdown to go with a rushing score, but he threw three interceptions and was charged with a fumble on a botched handoff with Mustafa Greene late in the first half.