STILLWATER, Okla. (AP) — Oklahoma State quarterback Taylor Cornelius was nearly flawless against Oklahoma last week, only to misfire on a 2-point conversion pass to Tylan Wallace in a one-point loss.

On Saturday, the connection worked. Cornelius threw a touchdown pass to Wallace with 42 seconds remaining and Oklahoma State beat No. 7 West Virginia 45-41.

The low-key Cornelius didn't show how disappointed he was in the way the Oklahoma game ended, but coach Mike Gundy had an idea how his redshirt senior felt.

"You could never see it, but you would think that inside it just tore him to pieces," Gundy said.

In his final home game, Cornelius passed for 338 yards and five touchdowns and ran for 106 yards and another score to help Oklahoma State (6-5, 3-5 Big 12) become bowl eligible.

"For him to be able to finish this way is a big deal," Gundy said.

Down 31-14 at the half, the Cowboys won despite leading rusher Justice Hill sitting out with a rib injury.

"Our coaches made tremendous adjustments at halftime," Gundy said. "I couldn't be prouder of them."

Chuba Hubbard rushed for a career-high 134 yards for Oklahoma State, and Dillon Stoner caught nine passes for a career-best 127 yards.

Grier passed 364 yards and two touchdowns, but his Heisman campaign took a hit with the loss. Kennedy McKoy rushed for a career-high 148 yards for the Mountaineers.

West Virginia (8-2, 6-2, No. 9 CFP) faces Oklahoma next Friday and can still reach the Big 12 title game with a victory.

Grier's 6-yard touchdown run on fourth down in the fourth quarter gave West Virginia a 41-31 lead, but Cornelius' 9-yard touchdown run and a stop by Oklahoma State's defense put the Cowboys in position to win.

West Virginia coach Dana Holgorsen felt his team should have been in a better position late.

"I think we left probably 14 points out there," he said. "When you are in the red zone and can't punch it in — if you are a great offense, you do that."

It's the first time Oklahoma State has beaten Top 10 teams in back-to-back home games — the Cowboys knocked off Texas on Oct. 27. In between, the Cowboys lost 35-31 at Baylor and 48-47 at Oklahoma.

"They have been in a lot of these games, and you can tell they had a little bit better mindset down the stretch than we did," Holgorsen said. "It's disappointing that we had a chance to close them out and we didn't."

THE TAKEAWAY

West Virginia: The Mountaineers wasted a major opportunity and now don't have quite as much to play for against Oklahoma.

Oklahoma State: Cornelius made up for two interceptions earlier in the game with a strong fourth quarter.

QUOTABLE

Oklahoma State offensive coordinator Mike Yurcich, on Cornelius: "If you can't respect the way that young man's played and how he's bounced back and how he's played against really good defenses — who's played better than him against the top defenses in this league?"

STAT LINES

Cornelius has completed 64 of 99 passes for 839 yards and eight touchdowns his past two games.

POLL IMPLICATIONS

West Virginia will likely drop out of the Top 10 after the loss.

UP NEXT

West Virginia has not beaten Oklahoma since it joined the Big 12 in 2012. The Mountaineers host the Sooners on Black Friday night.

Oklahoma State plays at TCU on Saturday.

___

Follow Cliff Brunt on Twitter: www.twitter.com/CliffBruntAP

___

More AP college football: https://apnews.com/tag/Collegefootball and https://twitter.com/AP_Top25

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.