The script called for either Brandon Ingram or Grayson Allen to take the final shot.

The ball wound up in the hands of Allen—and he delivered his lines perfectly.

With Duke trailing by one, Allen inbounded the ball to Marshall Plumlee with six seconds left, then got it right back. Anthony Gill picked up the sophomore aggressively as Allen came off the Plumlee screen near the top of the key, but the sophomore turned the corner and drove the ball to the rim against Marial Shayok, took a final step and banked in a game-winning runner as time expired, lifting Duke past No. 7 Virginia 63-62.

Thanks to Allen's late-game heroics, the Blue Devils pulled off their second straight home win against a ranked opponent Saturday at Cameron Indoor Stadium. Allen scored 11 of his 15 points in the second half—including the game-winner—and Ingram scored a game-high 25 to lead Duke to its 17th straight win against the Cavaliers in Durham.

Thirty seconds earlier, Allen had missed two free throws with Duke leading by one, and Malcolm Brogdon's no-look reverse layup with 10 seconds to go gave the Cavaliers a 62-61 lead.

"Free throws are something that should be automatic for me, so me missing those, I was pretty mad after that, I’m not going to lie," said Allen, an 86.1 percent free-throw shooter who went 7-of-11 Saturday. "Time does go a lot slower, and I kind of knew that. I knew I had enough time to make a move and take a couple of dribbles."

The referees checked the replay monitor to ensure the ball left Allen's hand in time—it did, with about two-tenths of a second to spare—and the Jacksonville, Fla., native eventually emerged from the pile of Blue Devil teammates that had tackled him in celebration.

"If [Virginia helped on the drive], I was going to kick out and find a shooter," Allen said. "But I felt like I had the lane, I had my man one-on-one. I knew he was going to be strong and body up, and I knew I had to go through that and finish."

Allen scored seven of Duke's final 10 points, but Ingram carried the Blue Devils (19-6, 8-4 in the ACC) for much of the game after shaking off a slow start.

The freshman made seven straight field goals and scored 18 consecutive Duke points spanning halftime as the Blue Devils surged back from a double-digit deficit, then held on as the Cavaliers (20-5, 9-4) erased a seven-point deficit of their own.

Duke rattled off 10 unanswered points in the second half and held Virginia scoreless for 4:51 to build a 51-44 lead. But then it was the Blue Devils' turn to go cold, enduring a scoring drought of nearly four minutes that allowed the Cavaliers to climb back within two.

With the game tied at 56, Ingram swooped in for an offensive rebound to end a personal string of four straight misses, but Brogdon answered with a layup on the other end.

Allen splashed in two free throws coming out of the under-four media timeout, and Plumlee split a pair after getting hacked late in the shot clock. Duke had a chance to add to its lead with an offensive rebound, but Matt Jones' 3-pointer did not go down.

London Perrantes calmly hit two from the charity stripe to cut the lead back to 61-60, and that score prevailed into the game's final minute. Devon Hall stripped Plumlee down low, but Brogdon's runner was no good.

Brogdon scored a team-high 18 points, but he was just 1-of-6 from downtown and Perrantes—a conference-best 53.4 percent 3-point shooter—did not attempt a shot from beyond the arc.

"One of our goals this game was that since [Perrantes] and Brogdon have taken about two-thirds of their threes, to give them no threes," Duke head coach Mike Krzyzewski said. "That’s easier said than done but Matt and Derryck [Thornton] did a really nice job."

Early on, the Blue Devils got eight points in the paint off of dribble penetration by their guards against a stout Cavalier defense. But Virginia took control of the game with a 15-1 run midway through the first half to go up 25-14. Center Mike Tobey subbed in off the Cavalier bench and promptly hit 4-of-5 shots to key the spurt, taking advantage of the buffer afforded him by Plumlee around the free-throw line.

On the other end, Virginia closed up the holes in its defense and kept the Blue Devils around the perimeter, where Duke opened the game shooting just 1-of-9. That would soon change.

Krzyzewski burned a timeout to stop the bleeding, and the Blue Devils did just that, climbing back into the game with seven unanswered points. Thornton started the mini-run with a pull-up jumper, then Allen found Matt Jones after a pump-fake for a wing 3-pointer, Jones' second of the half. On the next trip down, the 6-foot-9 Ingram posted up Perrantes, turned around a hit a jumper to cut the lead to four and force a Virginia timeout.

The Blue Devil offense ran through the freshman for the rest of the half—Ingram scored eight straight points, including two 3-pointers and a vicious blow-by dunk against Gill.

"[Krzyzewski] got on me a little bit after the first eight minutes of the game—I wasn’t being myself," Ingram said. "I felt like I had to be more aggressive, and I started knocking shots down and felt more comfortable."

Ingram started the second half just as he ended the first—on fire. The Kinston, N.C., native dropped in a short jumper on Duke's first possession of the half, then took a feed from Allen and drilled another 3-pointer to tie the game at 36. After a foul on Gill, the Blue Devils inbounded the ball to Ingram, who knocked in his fourth triple of the game.

Virginia weathered the onslaught with jumpers from Gill and Isaiah Wilkins, but after finally missing a shot, Ingram drove the lane again and found Jones open at the top of the key for a game-tying 3-pointer.

After the 1-of-9 start, Duke made seven of its next 3-pointers, led by Jones—who had four triples and did not miss from downtown until 1:59 left in the game.

Allen and Ingram wound up with 23 of Duke's 32 second-half points, using Plumlee ball-screens to try to drive against the Cavalier defense. The Blue Devils did so relentlessly all game long, and it ended up working to perfection on thee games final play.

"Those two kids are the kids who can improvise for us. We just try to put them in positions where they use their talents and they know that we have confidence in them," Krzyzewski said. "The basketball gods were good because [Allen] is such a good player."

Duke will head to No. 9 North Carolina Wednesday at 9 p.m. to renew the Tobacco Road rivalry and continue its four-game gauntlet against the class of the ACC.