SYRACUSE, N.Y. (AP) Syracuse's season hung in the balance. After two straight defeats in heartbreaking style, the Orange was perched on the precipice of another crushing loss after coughing up a 20-7 lead.

But then redshirt freshman quarterback Tommy DeVito came to the rescue, leading the Orange (5-2, 2-2 ACC) to a thrilling 40-37 double-overtime victory over North Carolina (1-5, 1-3) Saturday.

Instead of being down in the dumps, the Orange sits on the cusp of bowl eligibility, just one win away of making its first postseason appearance since 2013.

''It meant a lot. It could have been devastating,'' Syracuse running back Moe Neal said. ''Another overtime game, not going our way. It was a great win.''

DeVito entered the game late in the fourth quarter, in relief of a struggling Eric Dungey, and threw a career-high three touchdown passes for a career-best 181 yards. He hit tight end Ravian Pierce on a 4-yard scoring play in the second overtime to propel Syracuse to the win. On his first play, he connected with Jamal Custis on a 50-yard pass play.

''I just thought it might be a spark,'' Syracuse coach Dino Babers said. ''I just felt we needed to do something different. I just felt like they had a little bit of a beat on us. Sometimes when you change one character it throws off the defense. I don't know if it worked or not. I'm just happy with the result.''

It worked.

DeVito sent the game into overtime with a 42-yard touchdown pass to Nykeim Johnson with 1:39 to go. His 25-yard touchdown pass to Custis gave the Orange a brief lead in the first overtime until Nathan Elliott's 9-yard pass to Beau Corrales tied the game.

Babers wasn't surprised by DeVito's composure, and he wasn't tipping his hand as to whether there might be a changing of the guard at quarterback.

''He's been around here a long time,'' Babers said. ''We're calling the plays and he knows the plays. He looks at the coverages and he has to make some decisions. I don't think it's as big of a deal as you guys make.

''By no means am I saying it's a permanent change. We needed a little spark and obviously the other guy came in and did some things well.''

''You gotta be happy to get a game like that, especially in double overtime,'' DeVito said. ''To have the guys rally around you and to pull it off like this is special.''

North Carolina had rallied from a 20-7 deficit to take a 27-20 lead with 10 minutes to go in regulation but dropped its third straight game. A 12-yard touchdown run by Antonio Williams and a 75-yard punt return by Dazz Newsome gave the Tar Heels a 21-20 lead. Two field goals by Freeman Jones upped the margin to 27-20 with 10:15 to go.

''It's pretty heartbreaking. I thought we had multiple opportunities to seal the game but we didn't do that,'' Elliott said.

DeVito was ready to go and wasn't fazed by the moment.

''As far as me preparation-wise, I always like to prepare like I'm starter and always be ready for any given moment because you know anything can happen and sure enough it did so I was ready for the moment,'' he said. ''I was confident with the guys around me.''

''He did a great job, coming in that type of situation. He's a great quarterback. We know what he's capable of and he put it on display today,'' Neal said.

''Nothing changed when DeVito came in,'' North Carolina coach Larry Fedora said. ''The guy had a career day. He just threw the ball and made some great plays; put the ball where it had to be so you have to give him credit.''

Elliott was 34 of 52 for 321 yards and two touchdowns for North Carolina. Newsome also scored on a 6-yard touchdown pass.

North Carolina trailed 20-7 less than a minute into the third quarter after the Orange scored on a three-play, 54-second drive capped by Dungey's 16-yard run up the middle.

FLATTENED

Neal flattened an official early in the second quarter on a 24-yard carry. He would've had much more.

THE LONGEST YARDS

Dungey scrambled left, then scrambled right for officially a dazzling 12-yard gain, but he may have run 40 yards in the process.

SHANK YOU

North Carolina punter Hunter Lent had the worst kick of the day from his 22-yard line. His punt was marked just 10 yards downfield after ending up in the stands. His flub resulted in a short field and a Syracuse touchdown.

THE TAKEAWAY

North Carolina: Heavy underdogs, the Tar Heels gave Syracuse a run for its money only to suffer a heart-breaking loss. With another road game coming up, the Tar Heels are headed for a long second half of the season.

Syracuse: Quite simply, this game saved the Orange's season. A loss to the Tar Heels would have put bowl hopes in jeopardy. And, the Orange might have seen a changing of the guard at quarterback.

UP NEXT

North Carolina: The Tar Heels conclude their two-game road trip Saturday against Virginia.

Syracuse: The Orange hosts North Carolina State Saturday.

----

More AP college football: https://apnews.com/tag/Collegefootball and https://twitter.com/AP-Top25

Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.