BLACKSBURG, Va. -- Following his team's victory over No. 17 Virginia Tech on Saturday, East Carolina coach Ruffin McNeill sought out his quarterback Shane Carden and they shared a lengthy embrace in the south end zone of Lane Stadium.

The hug for Carden was well deserved.

Editor's Picks Adelson: Virginia Tech falls into trap The game screamed letdown. Yet Virginia Tech failed to see all the signs, failed to heed all the warnings -- and fell into the same pothole that has become all too common after big wins, Andrea Adelson writes.

More from ESPN.com Every team's schedule is littered with potential trap games, and the great thing about the sport is we never know when the booby traps will explode in our faces, Mark Schlabach writes. 1 Related

Carden threw three touchdown passes and scored a rushing touchdown with 16 seconds left to lead the Pirates to a 28-21 upset of the Hokies.

The senior from Houston, Texas, completed 23 of 47 passes for 427 yards in carrying the Pirates to their first victory over a ranked team since 2009 when they beat then-No. 18 Houston 38-32 in Greenville, North Carolina.

They also beat a ranked team on the road for the first time since 1996 when they topped then-No. 12 Miami 31-6.

East Carolina (2-1) snapped a five-game losing streak to ranked opponents.

"Coming back from adversity from last week (a 33-23 loss to South Carolina), that's what that hug was about," McNeill said.

"Staying the course and believing what you believe in, that's what that hug was about. Getting it done as one heartbeat, one breath, one mind, one Pirate ... that's what that hug was about."

The Pirates nearly squandered a three-touchdown lead. Virginia Tech (2-1), coming off a road win over then-No. 8 Ohio State, tied the game at 21 on an 18-yard touchdown pass from Michael Brewer to Cam Phillips with 1:20 left.

But the Pirates, after doing little in the second half, needed just three plays to go 65 yards. Virginia Tech kicker Joey Slye kicked the ensuing kickoff out of bounds, giving the Pirates the ball at their 35.

Then, Carden threw passes of 31 and 28 yards to Cam Worthy sandwiched around an illegal substitution penalty on the Hokies. He scored on a 1-yard run to lift the Pirates to the win.

"Just believing," Carden said when asked how the Pirates rallied. "Just continuing to believe. We just made some routine plays. They were playing some good defense there in the second half and we couldn't get a lot going. But we just kept believing, believing in our coaches.

"We got some good field position to start, and then Worthy made some big-time catches on that drive. When the game is on the line, you've got to make plays."

Worthy finished with six catches for 224 yards for the Pirates.