WACO, Texas (AP) A rough day for Baylor kicker Connor Martin ended with a game-winning field goal.

Martin missed three field goal attempts and an extra point, but his third made field goal was a 29-yarder with eight seconds left Saturday to give the Bears a 37-34 win over Kansas State.

''I felt like I owed everybody,'' Martin said. ''My job as a specialist is to help bail out the offense when they're not able to get things going. I feel like our offense and defense bailed me out. I left a lot of points on the field, so I really wanted it for them. I was like I've got to make it for these guys because they saved my butt all day.''

After Kansas State tied the game at 34 on Skylar Thompson's 28-yard touchdown pass to Dalvin Warmack with 4:26 left, quarterback Charlie Brewer set up the Bears (4-2, 2-1 Big 12) for the game-winning kick by driving them 76 yards on 11 plays.

''As a quarterback in this offense, you like that situation, to have a chance to go seal the deal there at the end,'' said Brewer, who completed 30 of 44 passes for 296 yards with a touchdown and interception. ''Which we were able to do.''

Jalen Hurd had 11 catches for 135 yards, and the former Tennessee running back also ran for 56 yards and a touchdown for the Bears, who last year won only once in coach Matt Rhule's first season. Trestan Ebner ran for 100 yards.

Alex Barnes ran 22 times for 250 yards and three touchdowns for Kansas State (2-4, 0-3).

''The offensive line had a really good day today, and most of those runs I was not touched,'' Barnes said. ''I was getting to the second and third level scot free, so it's a well-executed game plan that we had in the run game and by the coordinators calling the game.''

A week after Thompson came in after halftime and sparked the Wildcats in a home loss to Texas, he returned to the starting role and played the entire game. He was 15 of 26 for 149 yards with a touchdown and two interceptions and ran for 50 yards and a score.

Barnes opened the fourth quarter with a 48-yard TD run that tied the game at 20 before the Wildcats' extra point was blocked. Thompson's 52-yard TD run with 10:38 left put the Wildcats ahead.

''I don't know how he graded out, but he'd like to have some snaps back,'' K-State coach Bill Snyder said. ''He also did some good things. He played OK. He could have played better. He led some drives and did a nice job, especially early in the ballgame.''

Brewer's 21-yard TD pass to Denzel Mims tied the game again before freshman Craig Williams scored on a 21-yard run with 6:41 left to put the Bears back in front.

''That first college touchdown feels great,'' Williams said. ''I'm going to remain humble, stay patient, and when my number is called again, I'll be ready.''

THE TAKEAWAY

Kansas St.: Despite the loss, Barnes had another field day at McLane Stadium, where he ran for 129 yards and four touchdowns in 2016. The Wildcats had problems on special teams, including fumbling the opening kickoff of the second half, missing a field goal, muffing a punt they recovered and having an extra point blocked that would have given them a 21-20 lead early in the fourth quarter.

Baylor: The Bears could have put this one away much sooner. They reached at least the Kansas State 32 five times in the first half and had 12 points to show for it. But they did a better job of keeping drives alive and reaching the end zone in the second half. They finished 10 for 17 on third-down conversions.

BEARS CASH IN ON MISTAKES

Baylor collected only two takeaways in the first five games of the season, but it came away with three.

More importantly, the Bears turned those Kansas State miscues into 21 points.

Safties Jairon McVea and Christian Morgan recorded the first interception of their Baylor careers, and the Bears pounced on the second-half kickoff for their first fumble recovery of the season.

UP NEXT

Kansas State is home next Saturday for the only time in a four-game stretch against No. 25 Oklahoma State.

Baylor travels about 100 miles south to play at No. 19 Texas next 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.