Virginia wide receiver Chuck Davis celebrates Saturday night’s upset win over Miami at Scott Stadium. (Steve Helber/AP)

On the heels of its most disappointing defensive performance this season, Virginia made the necessary corrections — and then some — at the expense of 16th-ranked Miami on Saturday night. The Cavaliers also managed just enough offense for a 16-13 homecoming upset at Scott Stadium.

An announced crowd of 42,393 witnessed Virginia intercept three passes and mostly stifle the No. 3 scoring offense in the conference for its first victory over a ranked opponent since 2014. In ending a nine-game slide against ranked teams, the Cavaliers (4-2, 2-1 ACC) stayed behind Virginia Tech in the Coastal Division.

Safety Juan Thornhill had two interceptions, with the senior’s second midway through the fourth quarter thwarting a promising drive for the Hurricanes (5-2, 2-1), who had a five-game winning streak halted.

“They’re becoming resilient,” Cavaliers Coach Bronco Mendenhall said of his team’s progress. “They’re becoming confident. They acknowledge it and see it happening, and for me and my staff, it’s just fun to watch them . . . feel that, sense that.”

The Cavaliers also got three field goals from Brian Delaney, making his first start at place kicker. The sophomore’s final 32-yard field goal put Virginia in front 16-6 with 10:49 left in the fourth quarter.

Miami failed to reach the end zone until quarterback Malik Rosier ran for an 11-yard touchdown with 3:04 remaining. The Hurricanes then attempted an onside kick that Virginia tight end Evan Butts scooped up and returned 30 yards to the Miami 27.

Facing third and three from the 20, quarterback Bryce Perkins managed just one yard on a run, but Hurricanes defensive tackle Tito Odenigbo delivered a late hit that drew a penalty. Then a roughing the kicker penalty on Trajan Bandy allowed Virginia to run off the final 30 seconds, prompting jubilant fans to rush the field.

The extra week of preparation allowed Virginia to address the defensive deficiencies that contributed to a 35-21 loss at North Carolina State.

The Cavaliers yielded 176 rushing yards and 433 yards of offense in that loss. The porous run defense came one week after Virginia’s most stout showing of the season in that category; it permitted just 66 yards to Louisville in its ACC opener.

Despite its uneven play, Virginia entered the weekend ranked third in the conference in total defense (324.6 yards per game) and fifth in scoring defense (20.4 points per game) roughly halfway through the third season under Coach Bronco Mendenhall.

On the other sideline Saturday night was the ACC’s top-ranked defense, with Miami coming into the game yielding 237.3 yards per game. The Hurricanes, also ranked first in the ACC in run defense, are one of two teams in the conference giving up fewer than 300 yards per game.

It didn’t take long Saturday for the Hurricanes to make an impact defensively, collecting an interception on the opening series when Bandy, a cornerback, gathered Perkins’s misfired pass. Bandy celebrated the sudden change of possession by donning the Hurricanes’ Turnover Chain on the sideline.

But the Cavaliers answered with a defensive stand of their own when they stopped freshman quarterback N’Kosi Perry, the original starter, one yard short on a run on fourth and two from the Virginia 49.

Perkins threw his second interception of the game late in the first quarter during the Cavaliers’ third series, but they got the ball back in short order when safety Joey Blount caught Perry’s underthrown pass over the middle and brought the ball to the Virginia 48 following a 31-yard return.

A targeting penalty assessed to Hurricanes cornerback Michael Jackson moved the ball to the Miami 26, and Virginia got as far as the 8 before settling for Delaney’s 26-yard field goal with 13:46 to go in the second quarter for the game’s first points.

The field goal attempt was the first of Delaney’s career. The Cavaliers continue to seek a reliable place kicker after giving chances to sophomore A.J. Mejia and freshman Hunter Pearson.

“Any win is great, and to be able to contribute to help the win just made it even that much better,” Delaney said. “Then the stakes of the win against a team as good as Miami, just building momentum for our season and keeping everything going, it just feels amazing to be a part of it.”

Another interception for Virginia, this time courtesy of Thornhill, who returned it 62 yards, set up the Cavaliers with first and goal at the 7. Two plays later, tailback Jordan Ellis powered into the end zone for a seven-yard touchdown with 11:16 remaining in the second quarter.

“I’m just very excited about the win,” Thornhill said. “I took a lot of responsibility on that loss last year [to Miami, 44-28]. I gave up two touchdowns and a deep ball, and this week, honestly I took this game very personal because I felt like they were going to come at me again. I had to make a statement. I had to redeem myself.”