The off-target throws, drops and mistakes kept coming for No. 13 Wake Forest. So did the injuries — all on a night when the Demon Deacons were trying to take a huge step toward winning their Atlantic Coast Conference division.

All that trouble merely ended up as the perfect setup for another memorable moment in a special season.

Sam Hartman accounted for four touchdowns while Justice Ellison ran for a short score with 1:47 left to help Wake Forest beat No. 21 North Carolina State 45-42 on Saturday night, moving within a victory of wrapping up the league's Atlantic Division race.

"It's fun to play in games like this," Clawson said. "It's even more fun to win them."

The next step for the Demon Deacons (9-1, 6-0 ACC) is to finish off the division race and supplant Clemson, which had won the Atlantic on the way to winning the past six league championships. To do so, Wake Forest must win one of their last two games to secure the division winner’s ticket to the ACC championship game.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Fittingly, in a matchup of the division's top two teams, the Demon Deacons had to grind to the final minute to hold off the Wolfpack (7-3, 4-2) and quarterback Devin Leary.

The night ended with Wake Forest fans joining the team on the field after the home finale in a celebration that lingered so long that the public-address announcer had to twice instruct the Demon Deacons players to head to the locker room.

Ellison’s 4-yard score pushed Wake Forest to a 45-35 lead, though N.C. State responded with a clutch drive that ended with Leary’s 8-yard touchdown pass to Devin Carter with 45 seconds left. The Wolfpack nearly recovered the onside kick, with Ricky Person Jr. grabbing the bouncing ball about a yard shy of the 10-yard requirement to secure the possession.

That illegal-touching penalty gave the ball to Wake Forest and held up on review, allowing Hartman to take a knee and melt the final seconds and prevent the Wolfpack from wrestling away control of the division race.

"All we can control is our next two and try to win both of those," Wolfpack coach Dave Doeren said. "... There’s a lot to play for. But right now we’ve got some disappointed and upset coaches and players."

Hartman overcame a difficult passing night against a defensive unit ranked among the best in the Bowl Subdivision. He completed just 20 of 47 passes for 290 yards with three touchdowns and three interceptions to go with a second-quarter rushing TD. But he came through in the clutch after the Wolfpack pulled within 38-35, completing a 12-yard pass to Donald Stewart on third down to move the chains and then doing it again with a 14-yarder to Taylor Morin.

Ellison capped that drive by scoring from 4 yards out, ending a 13-play, 75-yard drive that took nearly 6 1/2 minutes off the clock.

"It wasn’t a pretty game by any means," Hartman said. "A lot of mistakes on my end. Not very happy about that. but we pulled it out and that’s football in November."

Ellison scored three touchdowns, coming through with a 4-yard catch with 10:05 left as well as a 1-yard TD in the second quarter.

Leary threw for 408 yards and four touchdowns to lead the Wolfpack, with Emeka Emezie (133 yards) and Carter (132) each hauling in a pair of TD grabs. Zonovan Knight also returned the second-half kickoff for a 100-yard touchdown and a 27-24 lead, the first time the Demon Deacons had trailed in a home game after halftime this season.

THE TAKEAWAY

N.C. State: Add this to a growing list of frustrations for the Wolfpack when it comes to heading west on Interstate 40 for this game in Winston-Salem. State fell for the ninth time in 10 games here since 2001, a befuddling run that has included losses by eventual NFL quarterbacks Philip Rivers, Russell Wilson, Mike Glennon and Ryan Finley. This one will hurt worse than the others.

"We knew what was at stake this game, we knew what we could accomplish," Leary said, adding: "We can't go back and change anything, as much as we would like to."

Wake Forest: Last week, the Demon Deacons suffered their first loss after an 8-0 start in a nonconference matchup against in-state league foe North Carolina. But they regrouped to move closer to playing for the program's first league title since 2006.

EARLY EXITS

Both teams had players repeatedly going down to injuries.

Wake Forest entered down top cornerbacks Gavin Holmes and Caelen Carson, then lost receiver Jaquarii Roberson. For N.C. State, Knight twice had to limp off the field with an apparent right-leg injury.

Additionally, Wake Forest’s Ryan Smenda and N.C. State’s Shyheim Battle were ejected for targeting after halftime.

UP NEXT

N.C. State: Syracuse visits the Wolfpack next Saturday.

Wake Forest: The Demon Deacons visit Clemson next Saturday, seeking their first win against the Tigers since 2008 and their first win in Death Valley since 1998.