MANHATTAN, Kan. (AP) -- Kansas State's defense gave up big plays, its offense struggled to consistently move the ball and its special teams made more mistakes in one game Saturday than they often do in an entire season.
The Wildcats were still good enough to beat Kansas.
Alex Barnes ran for 117 yards and two touchdowns, Alex Delton scored the go-ahead TD from 21 yards out in the closing minutes, and Kansas State managed to hold on for a frigid, wind-blown 21-17 victory -- their 10th straight over their biggest rivals.
"They recognize there were things that could have been done that wouldn't have necessarily kept it a close ballgame," Wildcats coach Bill Snyder said of his players, "but to get the win when they're in the jaws of defeat, so to speak, it was significant for them. It was important."
Kansas State (4-6, 2-5 Big 12) trailed 17-14 when it got the ball back with 5:02 to go, and Barnes converted fourth-and-2 with a hard, hurdling run. Delton then connected with Dalton Schoen for 28 yards before taking a quarterback draw for a touchdown with 2:46 to go.
The Jayhawks (3-7, 1-6) reached the Kansas State 32 as they tried to answer, but Peyton Bender had the ball inexplicably pop from his hands while trying to pass with 20 seconds left to end the game.
"That last play is certainly not the play that lost us the game," said Kansas coach David Beaty, who is finishing out the season after getting fired last Sunday. "There were a lot of other things that I can point to that probably kept us from being able to win."
Bender finished with 232 yards passing and two TDs for the Jayhawks, who were trying to win their first road conference game since Oct. 4, 2008. Steven Sims had five catches for 113 yards and a score.
Bender's turnover summed up a game that boiled down to which team made fewer mistakes.
Kansas State's punt-block team was penalized for running into the kicker. So was its kick-block team. And punter Andrew Hicks was woefully short when he was summoned to try a 53-yard field goal.
Not to be outdone, Kansas answered with an 18-play, 94-yard drive that consumed nearly 10 minutes spanning the first and second quarters and was capped by ... a field goal.
Then, when the Jayhawks got the ball back, they marched to the Kansas State 33 before dropping a certain TD pass. Referee Reggie Smith called a false start penalty on "multiple players," a fumble and delay-of-game penalty followed, and the Jayhawks failed to run their field-goal unit on the field when they had a chance to kick a 56-yarder as time expired.
All that was missing from the first half was the circus music.
Kansas State special teams coach Sean Snyder's frustration continued on the opening kickoff of the second half, when the wind popped it up and none of the Wildcats could recover it.
But in the ultimate game of one-upmanship, Kansas promptly went backward in four plays to give the Wildcats better field position than if they had fair caught the kickoff.
Kansas State took its first lead a few minutes later, when Barnes ran 24 yards for a score. And after the Jayhawks answered with a 75-yard drive that Bender capped with a TD pass to Jeremiah Booker, it was Barnes finding the end zone again to help the Wildcats regain the lead.
Lest they have too much success, the Wildcats botched a field-goal attempt a few minutes later.
Kansas regained the lead when Bender hit Steven Sims on a 65-yard touchdown reception, but the Jayhawks promptly squandered a chance to put the game away. They had two 50-yard-plus runs wiped out by holding penalties, and an unsportsmanlike conduct penalty was tacked on when Jayhawks tight end Mavin Saunders apparently disagreed with the second holding call and tried to hide the flag.
"I saw it," Snyder said, cracking a grin. "Somewhat amazed."
The unsportsmanlike conduct penalty was tacked on and Kansas was ultimately forced to punt, and that gave Delton and the Wildcats the opening they needed for one more score.
"It was really big to finally get off a losing streak," said Barnes, who delivered the lead block on the go-ahead score, "and it's always good to beat Kansas."
"Our state deserves that game to be a good game and it was a good game today. It wasn't good for the Jayhawks because we want to finish with a victory, but it was a good game." -- Beaty.
Kansas: So much for giving Beaty a memorable victory. Despite being fired Sunday, he is finishing the season while athletic director Jeff Long crisscrosses the country in search of his replacement.
Kansas State: Sloppy as they were, the Wildcats managed to keep their bowl hopes alive. They still need to win their next two games to become eligible, though, and will need to play a whole lot better.
Kansas visits sixth-ranked Oklahoma next Saturday.
Kansas State plays Texas Tech in its home finale Saturday.