Baylor, Big 12 teams can play some defense, tooOklahoma State running back Jeremy Smith (31), attempts to run past Kansas State defensive back Dante Barnett (23), while being pursued by defensive lineman Chaquil Reed (98) during the first half of an NCAA college football game in Stillwater, Okla., Saturday, Oct. 5, 2013. (AP Photo/Brody Schmidt)
STILLWATER, Okla. (AP) -- Mike Gundy was just as baffled as everyone else watching Oklahoma State's offensive struggles for much of the second half against Kansas State.
The Cowboys' coach, however, wasn't about to complain about the late burst that led to a 33-29 win over the Wildcats on Saturday.
Led by J.W. Walsh's 6-yard touchdown pass to Charlie Moore with 4:13 remaining in the fourth quarter, No. 21 Oklahoma State (4-1, 1-1 Big 12 Conference) narrowly avoided its second straight loss and remained in the thick of the conference race.
The Cowboys fell behind 29-23 late in the fourth quarter. A six-play, 75-yard scoring drive - engineered by Walsh - came only after the Cowboys had fallen behind and watched as several scoring opportunities resulted in only field goals.
Afterward, Gundy had one wish looking back on the go-ahead drive.
''Whoever flipped the switch, I wish they'd flip it earlier,'' Gundy said. ''I don't know what to say. It was very well executed; guys made plays.''
While Oklahoma State breathed a sigh of relief, Kansas State was left to once again ponder what might have been - despite the emergence of Daniel Sams at quarterback.
Sams, who had attempted only four passes entering the game this season, accounted for 299 yards of total offense and three touchdowns for the Wildcats (2-3, 0-2). However, he also threw three interceptions - two of which came on Kansas State's last two drives - and lost a fumble as the Wildcats lost their second straight game.
Sams entered the game having shared time with Jake Waters at quarterback this season. The sophomore played the majority of the game on Saturday, finishing 15-of-21 passing for 181 yards and a pair of touchdowns, and he had 118 yards rushing on 27 carries.
The effort was nearly enough to help the Wildcats overcome 12 penalties for 92 yards.
''We started him because we were trying to do some things that we knew he could do, and get him invested collectively in the ballgame,'' Kansas State coach Billy Snyder said. ''As you can see, he came in and threw the ball just fine. I certainly don't like the interceptions.''
Oklahoma State led 17-14 at halftime thanks to a 3-yard touchdown run in the second quarter by Walsh, who bounced back from a two-interception performance last week in a loss to West Virginia.
The sophomore's best moment came following Sams' 3-yard touchdown that put Kansas State up 29-23 in the fourth quarter.
Following the score, Walsh opened the Cowboys' drive with completions of 12 and 26 yards to Josh Stewart and Tracy Moore, respectively. After a 16-yard run by Jeremy Smith, Walsh added a 15-yard strike to Brandon Sheperd before capping the go-ahead drive with his touchdown pass to Charlie Moore.
''It was one of those situations where the guys on the field knew we had to go down and score, and if we didn't, we may not win,'' Walsh said. ''We knew we had to take care of the ball and go score.
''We just put the ball in our playmakers' hands. When we do that, good things happen.''
Oklahoma State's Shaun Lewis and Daytawion Lowe followed with interceptions to end the Wildcats' final two drives and secure the win.
Sams put Kansas State up 7-0 in the first quarter with a 67-yard touchdown pass to Glenn Gronkowski, a play on which he faked the run before pulling up and slinging the ball over the middle to the streaking fullback.
The sophomore also found Torell Miller for a 17-yard touchdown pass to put the Wildcats up 21-17 to open the third quarter.
After falling behind, the Cowboys forced turnovers on each of Kansas State's next three possessions. They were only able to come away with a pair of field goals by Ben Grogan, however.
The freshman kicker, who missed a pair of field goals in the loss to the Mountaineers, connected from 30, 34, 23 and 28 yards out on Saturday.
Despite the turnaround in the kicking game, Gundy had no answers for an Oklahoma State offense that had no first downs in the third quarter.
''I don't have a clue,'' Gundy said. ''I really wish I could give you an explanation so it sounds good on the news tonight.
''We need to become a better football team from the 7-yard line in. That's a fact.''
Luckily for the Cowboys, Walsh had the answer when they needed it the most.