MANHATTAN, Kan. — Behind the play of a new quarterback and an old cornerback, West Virginia snapped its longest losing streak in seven years, upsetting No. 24 Kansas State 24-20 at Bill Snyder Family Stadium on Saturday afternoon.

It was West Virginia’s first win since the last time it set foot in the Sunflower State. The Mountaineers (4-6, 2-5 Big 12) lost five straight after opening the Big 12 schedule with a 29-24 win at Kansas on Sept. 21.

“This is a huge win,” said West Virginia coach Neal Brown. “It felt like a long time coming. We’ve been knocking on the door. We felt we would be in a position to win a game that maybe we shouldn’t have. To come in here and beat the No. 24 team, that beat Oklahoma, it’s big for our program. They believed the whole time.”

It’s easily the biggest win for Brown in his first year at WVU, and among the most significant in his career. Brown’s only other victory over a Top 25 team came when Troy upset No. 25 LSU in 2017.

Quarterback Jarret Doege made his first career start as a Mountaineer, completing 20 of 30 passes for 234 yards and three touchdowns. No completion was bigger than his 50-yard touchdown pass to redshirt freshman Bryce Wheaton on third-and-22, giving West Virginia the lead with 11:27 remaining in the fourth quarter.

The Kansas State (6-4, 3-4) secondary lost track of Wheaton, who slipped behind the safeties when they bit on the possibility of Doege breaking loose for a run despite the third-and-long situation. Doege was scrambling to keep the play alive before unleashing the throw.

“It’s tough when a quarterback scrambles, because sometimes players don’t know if they are past the line of scrimmage or not,” said Kansas State safety Denzel Goolsby. “I saw the ball getting thrown on the other side of the field, and a guy must have been able to get open… it was a good play on their part.”

Doege paid the price for keeping the play alive until the last possible moment, getting decked to the ground right after he released the throw downfield.

“Fortunately I was able to get it off before I got hit,” Doege said. “I didn’t know exactly if he caught it or what happened until I looked up and he was in the end zone.”

Scott Sewell/USA TODAY Sports

West Virginia Mountaineers cornerback Hakeem Bailey (24) is congratulated by a teammate after making a last-second interception to win the game against the Kansas State Wildcats at Bill Snyder Family Stadium.

West Virginia spent the rest of the game hanging on for dear life. The Wildcats drove into WVU territory twice in the fourth quarter, but did not score.

Kansas State made it to the WVU 36 on the drive after the touchdown, but that drive ended thanks to a Keith Washington pass breakup on fourth down.

The Wildcats looked like like they had the winning connection when quarterback Skylar Thompson spied an open Dalton Schoen running a post pattern to the end zone with 30 seconds remaining. But West Virginia senior cornerback Hakeem Bailey closed that ground quickly, leaping in front of Schoen to snag the game-clinching interception at the 3-yard line.

“The guy was open. It’s a route we’ve had trouble with. They made a good call,” Brown said. “The ball kind of hung up and Bailey went in and made a good play.”

Brown felt it appropriate that Bailey in particular was the player who sealed the deal.

“Since we came in here in January, he’s really tried to do everything right,” Brown said. “So I think it was fitting for him in this win to make the play that kind of capped it off.”

With the win, the Mountaineers stayed alive for a bowl bid if they can close out with wins over Oklahoma State and TCU.

Highlight-reel play sidelines Norwood

West Virginia senior safety Josh Norwood’s career as a Mountaineer is apparently over after what might have been his finest play.

WVU radio sideline reporter Jed Drenning reported that Norwood broke his collarbone when he landed on the ground following an acrobatic second quarter interception of Skylar Thompson. Norwood had no chance to brace himself for a heavy fall after the remarkable grab.

“Tremendous play,” Brown said after the game. “I’ll probably talk more about him on Tuesday. Early indications are not good for him.”

It was the first — and, unfortunately, final — interception of Norwood’s career.

Legg shows off leg

Brown kept his faith in backup kicker Casey Legg, and it paid off in a big way when Legg drilled a 51-yard field goal early in the fourth quarter.

Legg, starting his third game in place of the injured Evan Staley, missed a 37-yard try on the final play of the first half.

“I told him ‘we’re going to need you,’” Brown said. “He has really risen to the challenge. We wanted the wind in the fourth. We felt he could make one with the wind [at his back].”

Legg’s kick — his second career make — was the longest for a West Virginia kicker since Josh Lambert made a 51-yarder at TCU in 2015.