Ollie Gordon II ran for his fifth touchdown of the game in the second overtime, and the No. 21 Cowboys rallied from an 18-point deficit to defeat the Cougars 40-34 on Saturday, securing a spot in the Big 12 championship game.
BYU had a chance to win after Gordon's final score, but Oklahoma State's Trey Rucker ripped the ball from Isaac Rex after a catch and recovered the fumble to end it. The Cowboys celebrated the third-largest comeback in school history after the play was confirmed by replay review.
It's been that kind of season for Oklahoma State -- unpredictable but, ultimately, successful. The Cowboys started 2-2, including a 33-7 home loss to South Alabama. After winning five straight and beating rival Oklahoma, the Cowboys lost 45-3 at UCF.
They followed that with huge comebacks to beat Houston and BYU. The Cowboys overcame deficits of 14 points or more in consecutive games for the first time in school history.
"We sure make it hard on ourselves to get to where we want to go," Oklahoma State coach Mike Gundy said. "That was a really good win for our team. I'm very proud of them."
Oklahoma State (9-3, 7-2 Big 12, No. 20 CFP) eliminated Oklahoma from the title game. The Cowboys will play No. 7 Texas next Saturday at AT&T Stadium in Arlington, Texas, seeking their first conference title since 2011.
The Cowboys, who lost the conference title game two years ago to Baylor, did not meet the Longhorns in the regular season.
"Texas is playing at very high level right now," Gundy said. "Texas has good players. Texas has great players. They've always had them. They play at a high level. They're not an easy team to play. But I like my team."
Gordon, who entered the week as the nation's leading rusher, finished with 166 yards on a cold, rainy day and has 1,580 this season. His five touchdowns tied a school record Barry Sanders set three times in 1988, his Heisman Trophy-winning season.
On his game-clincher, he took a handoff and started left, shrugged a defender and reversed field, then launched himself over two BYU players into the end zone.
"You know, it was just more of a thought process of I couldn't let my guys down," Gordon said. "Most of our O-linemen are seniors and they've been playing their butts off this whole season. And, you know, I just wouldn't want to sell them anything short."
Jake Retzlaff passed for 166 yards and ran for two touchdowns for BYU (5-7, 2-7), which needed a win to become bowl eligible. Retzlaff started in place of Kedon Slovis, who has been fighting shoulder and elbow injuries.
The teams traded scores in the final minute to force overtime. Gordon's 15-yard touchdown with 53 seconds remaining put Oklahoma State ahead 27-24, but BYU's Simi Moala blocked the extra point. BYU finally put some offense together, and Will Ferrin made a 48-yard field goal as time expired in regulation.
Retzlaff and Gordon traded rushing touchdowns in the first overtime before Gordon's go-ahead 2-yard run in the second OT.
BYU led 24-6 at halftime. Gordon's first touchdown, a 2-yarder four minutes into the third quarter, got the Cowboys within nine. Another 2-yard score by Gordon and a 2-point conversion pass from Bowman to Rashod Owens cut BYU's lead to 24-21 with 10:53 remaining.
Retzlaff scored on a 2-yard run to put the Cougars ahead 7-6 late in the first quarter. BYU seemingly gained more momentum by recovering an onside kick, but an illegal block took it away.
Early in the second quarter, Eddie Heckard intercepted Bowman and ran it back 13 yards for a touchdown to put the Cougars up 14-6.
The Cougars struck again, closing an 89-yard drive with an 11-yard scoring run by Keelan Marion. BYU added a 42-yard field goal by Ferrin before halftime but didn't score again until the final play of regulation.
"We did everything we could," BYU coach Kalani Sitake said. "In the end, mistakes cost us, but the guys fought hard. I appreciate how hard they fought. They just didn't make enough plays, especially in the second half."
BYU's loss meant that of the Big 12's four new members this year, only UCF qualified for a bowl.
The Associated Press contributed to this report.