WACO, Texas (AP) Baylor quarterback Charlie Brewer started the week in concussion protocol and didn't get his usual snaps with the first-team offense in practice. And he didn't play the first three quarters against the Cowboys on Saturday.

When Brewer finally got in the game, he helped the Bears rally to beat Oklahoma State.

''It was time,'' coach Matt Rhule said of the decision to put Brewer in the game.

Brewer led the Bears to consecutive touchdowns drives, and his second TD pass was a 6-yarder to Denzel Mims with seven seconds left for a 35-31 win.

The winning score came right after Brewer had a 2-yard run with no timeouts remaining and the clock still running. He expected the decision to clock the ball, but then got the signal for the last play that resulted in the game-winning score.

''We were so close that we still would have had time to kick a field goal,'' Brewer said. ''As a quarterback you have to be ready for anything.''

The win gets Baylor (5-4, 3-3 Big 12) within one win of bowl eligibility, a year after winning only one game in Rhule's first season.

On Brewer's first drive, the Bears went 86 yards - aided by 30 yards of penalties against the Cowboys - and scored on a 36-yard TD pass to Jalen Hurd with 5:43 left.

Baylor's game-winning drive started after Oklahoma State (5-4, 2-4) was stopped on fourth down, when Chris Miller sacked Taylor Cornelius for a 9-yard loss with 1:31 left.

''You're in fourth-and-3. You get a chance to get a first down, the game's over,'' Oklahoma State coach Mike Gundy said. ''If you punt it, they are going to get it at the 20. I would have liked for Taylor to have thrown the ball away.''

The Bears then went 55 yards on eight plays, the winning score coming on Brewer's TD fade pass to Mims - his only catch of the game a leaping grab over cornerback A.J. Green.

''Two plays before that I overheard them talking on the sideline about throwing it to me,'' Mims said. ''So I knew coming into that last play I was going to get the ball. So I was like, I've got to go make that play. ... When I did it, it was just an exciting moment.''

John Lovett ran for 104 yards and a touchdown, including a 75-yarder one play after Oklahoma State took a two-score lead late in the third quarter. Jalan McClendon got the start at quarterback for Baylor and threw for 102 yards with an interception. He had a 1-yard touchdown on a quarterback sneak.

Baylor's only lead before the final score was after a blocked punt by Christian Morgan that was taken seven yards to the end zone by Trestan Ebner to make it 14-10 in the second quarter.

Cornelius threw for 287 yards and a touchdown and ran for a score. Justice Hill had 119 yards rushing and a touchdown for the Cowboys. Tylan Wallace scored twice in the third quarter, with a 6-yard run and 8-yard catch.

''I don't even need a stats sheet to know what happened,'' Gundy said. ''We're not a good enough football team to have that many penalties (12 for 133 yards) and a special-teams blunder, and give up a touchdown.''

THE TAKEAWAY

Oklahoma State: The Cowboys led most of the way but couldn't follow up its upset win over then-No. 6 Texas. That leaves them one win shy of being bowl eligible for the 13th straight season, with road games against No. 7 Oklahoma and TCU, and a home tilt with No. 12 West Virginia left on the schedule. In addition to the blocked punt, Matt Ammendola had a 47-yard field goal blocked and was well short kicking a 45-yarder into a stiff breeze.

Baylor: The Bears were winless at home last season but are 4-1 with only a reeling TCU team still set to come to McLane Stadium. They won despite coming up empty on their first two drives, both of which ended inside the Oklahoma State 10. The first was an interception in the end zone by Rodarius Williams, and Connor Martin missed a 26-yard field goal to end the second.

UP NEXT

Oklahoma State: Bedlam at No. 7 Oklahoma next Saturday.

Baylor: at Iowa State on Saturday.

---

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

Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.