Walsh's late TD pass lifts No. 21 Oklahoma State past Kansas State 33-29

Oklahoma State wide receiver Jhajuan Seales catches a 43-yard pass from quarterback J.W. Walsh during the first half of an NCAA college football game against Kansas State in Stillwater, Okla., Saturday, Oct. 5, 2013. (AP Photo/Brody Schmidt) (The Associated Press)

Oklahoma 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) (The Associated Press)

J.W. Walsh found Charlie Moore for a 6-yard touchdown pass with 4:16 left in the fourth quarter to help No. 21 Oklahoma State rally for a 33-29 win over Kansas State.

Walsh finished 24-of-38 passing for 245 yards for the Cowboys, who narrowly avoided their second straight loss after a defeat at West Virginia last week.

After falling behind 29-23 in the fourth quarter, Oklahoma State (4-1, 1-1 Big 12 Conference) drove 75 yards in six plays. Walsh was 4-of-5 passing on the drive, including the go-ahead touchdown pass to Moore.

Ben Grogan later added a field goal for the Cowboys, one of four in the game for the freshman.

Daniel Sams accounted for 299 yards of total offense and three touchdowns for the Wildcats (2-3, 0-2), who lost their second straight game.