MIAMI GARDENS, Fla. (AP) Virginia Tech allowed a Hail Mary pass for a touchdown, got outgained by more than 200 yards, couldn't hold a 28-point lead and allowed three touchdowns in less than 4 minutes down the stretch.

And the Hokies won.

Deshawn McClease's 3-yard run with 1:03 remaining capped a wild back-and-forth final few minutes, Dalton Keene caught three touchdown passes and Virginia Tech held on to beat Miami 42-35 on Saturday - a game where the Hokies forced turnovers on each of the Hurricanes' first four possessions yet still needed to deflect two passes in the final 5 seconds to escape with the win.

''I'm obviously very proud of our men,'' said Virginia Tech coach Justin Fuente, whose team was coming off a 45-10 home loss to Duke and gave Hendon Hooker his first career start at quarterback Saturday. ''Battled back. Not just in the game, but through the week of preparation. It was a rough week for everybody. I think it says a lot about their character, their unity, their toughness, their commitment to Virginia Tech.''

The Hokies (3-2, 1-2 Atlantic Coast Conference) led 21-0 after one quarter, 28-0 with 9:30 left in the first half and 35-14 midway through the fourth quarter. McClease's gamewinning TD came on a play where Miami was trying to intentionally let him score in an effort to get the ball back with some time remaining, and even that almost didn't work.

''An absolutely insane football game,'' Miami coach Manny Diaz said.

He wasn't wrong. Miami nearly matched the biggest comeback to win in school history; it trailed Boston College 28-0 in 1999 before rallying to win. Jeff Thomas caught a pair of touchdown passes in a span of 2:08 to turn a 35-14 deficit into a 35-27 one, and instead of kicking the extra point after the second of those scores the Hurricanes went for two - which Deejay Dallas got on a busted play, somehow getting the ball over the pylon.

Miami got a stop on the ensuing possession, Dallas scored on a 62-yard run with 3:16 left to tie the game and Hurricanes kicker Bubba Baxa missed the extra point. The Hokies then marched 63 yards in five plays for the go-ahead score, with Keene hauling in a big 26-yard catch on third-and-5 from the 29.

''We were confident we would get the win,'' Keene said.

It still came down to the last second. Miami went to the Virginia Tech 10, and Hurricanes quarterback N'Kosi Perry - who had a career-high 422 yards and a career-high-tying four touchdowns in relief of starter Jarren Williams - had two throws to the end zone batted down to end the game.

''There are a lot of guys in that locker room that played good enough to pull off one of the most historic wins of all time,'' Diaz said. ''And yet everybody in that locker room, coaches included, made enough mistakes execution-wise to really make us feel the way we feel right now - which is pretty awful.''

The Hurricanes outgained the Hokies 563-337, with Brevin Jordan having 136 receiving yards and a score. Hooker was 10 of 20 passing for 184 yards and three touchdowns for Virginia Tech, which faced former teammate Trevon Hill - who had three tackles and a sack for the Hurricanes.

The Hokies were two-touchdown underdogs and had lost six of their last seven ACC games. No matter. They won the turnover battle 5-0, posted a season-high seven sacks, and had the 28-0 lead before Miami's Mark Pope caught a deflected pass in the end zone on the final play of the half.

''I'm proud of how Hendon handled the promotion, if you will,'' Fuente said.

The Hurricanes are off to their worst five-game start since also going 2-3 in 2011, Al Golden's first season at Miami.

''We're going to be good,'' Jordan said. ''I'm still very confident in this team.''

THE TAKEAWAY

Virginia Tech: The Hokies avoided their worst start in conference play since 1951 - when they were in the Southern Conference. The win also gives a huge boost to the Hokies' bowl hopes; they've been to the postseason in 26 straight seasons, the nation's longest such streak, and will need to go 3-3 in their final six games (next week against Rhode Island is meaningless for bowl purposes) to continue.

Miami: The Hurricanes had turnovers on four consecutive possessions for the first time since the 2010 Sun Bowl against Notre Dame. Williams hadn't thrown an interception on any of his first 120 Miami passes (117 this season) before getting picked off on Miami's first drive, and finished 4 of 7; all three incompletions were interceptions. The last time Miami had more turnovers than Saturday was 2010, when it had six - also against Virginia Tech.

DEFENSE TRAVELS

This was the seventh time since 2004 that Virginia Tech forced at least five turnovers. All seven were road games - each of the last three in Florida (2010 at Miami, 2018 at Florida State).

UP NEXT

Virginia Tech: Host Rhode Island on Saturday.

Miami: Host Virginia on Friday.

---

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

Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.