Houston and West Virginia put together a classic college football matchup on Thursday night, and the Cougars were able to come away with the victory thanks to some late-game heroics, 41-39.

West Virginia thought they had the game in the bag. Garrett Greene threw a 50-yard touchdown pass to Hudson Clement with 12 seconds left to take the lead. Clement broke a tackle and beat out the Houston defense to cross the goal line. The Mountaineers were jubilant.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Donovan Smith wins

Houston quarterback Donovan Smith, #1, celebrates after rushing for a touchdown against West Virginia during the second quarter of an NCAA college football game Thursday, Oct. 12, 2023, in Houston. (AP Photo/Kevin M. Cox)

It did not last long.

Two plays later, Donovan Smith dropped back and fired a pass as far as he could. The ball got the end zone, and it was batted a couple of times before it fell into the hands of Stephon Johnson. He caught and Houston celebrated.

APP USERS VIEW THE PLAY HERE.

HEISMAN TROPHY POWER RANKINGS: MICHAEL PENIX JR LEAPFROGS CALEB WILLIAMS

The two teams combined for 42 points in the fourth quarter. The Cougars entered the final frame up 21-17 before Greene ran for a touchdown to get West Virginia back on top.

Houston celebrates

Houston fans celebrate on the field after the team's win over West Virginia in an NCAA college football game Thursday, Oct. 12, 2023, in Houston. (AP Photo/Kevin M. Cox)

Smith finished 21-for-27 with 253 passing yards, four touchdown passes and a rushing touchdown. Johnson had four catches for 96 yards and two touchdowns. Joseph Manjack IV and Samuel Brown had the other two touchdown catches.

Greene had four total touchdowns, two through the air and two on his feet. He had 391 passing yards. Devin Carter led West Virginia with five catches for 116 yards. Clement had two catches for 59 yards.

Garrett Greene runs for a TD

West Virginia quarterback Garrett Greene, #6, rushes for a touchdown against Houston during the fourth quarter of an NCAA college football game Thursday, Oct. 12, 2023, in Houston. (AP Photo/Kevin M. Cox)

CLICK HERE TO GET THE FOX NEWS APP

Houston moved to 3-3 on the year. West Virginia fell to 4-2.