LAWRENCE, Kan. -- Texas avoided an unsightly upset Saturday against Kansas, and the Longhorns have Case McCoy to thank.
McCoy, the Longhorns' backup quarterback, found tight end D.J. Grant on a one-yard touchdown pass with 12 seconds remaining to help the Longhorns escape Memorial Stadium with a 21-17 victory.
"We thought Case was prepared," Texas coach Mack Brown said. "He gave us the momentum that we needed to get it turned in the right direction."
The No. 23 Longhorns (6-2, 3-2 in the Big 12) survived despite a multitude of errors that had Kansas (1-7, 0-5) poised to snap a 16-game losing streak in conference play.
Texas trailed, 17-14, when Nick Prolago of Kansas kicked a 29-yard field goal with 2:33 remaining.
McCoy, inserted in place of starter David Ash, hit Jaxon Shipley on fourth down to prolong Texas' final drive, then connected with Mike Davis for 39 yards to give the Longhorns first-and-goal at the Kansas three-yard-line.
After Kansas stuffed two running plays, McCoy found Grant alone in the end zone on a third-down pass.
"It wasn't anything I did," said McCoy, who completed 5-of-7 passes for 68 yards. "I think our coaches and our team just decided to dig down deep and decide to fight."
For Brown, the game evoked memories of a 2004 game at Kansas won on a late touchdown pass by Vince Young.
"You all always talk about losses," Brown said. "I don't. What I thought about was it's so similar to 2004, and the 2004 team ended up in the Rose Bowl."
Texas avoided a third loss in four games, despite seeing its defense gashed again, this time by a Kansas rushing attack that churned out 234 yards.
Junior James Sims ran for a career-high 176 yards for the Jayhawks, who alleviated pressure on freshman quarterback Michael Cummings, throwing only four passes after the first quarter.
"Going into this game we had more passes in the game plan than that," Kansas coach Charlie Weis said. "They saw an inexperienced quarterback, and we figured they were going to have a lot of exotic (looks) on defense."
After struggling for most of the game, Texas broke through with an 11-yard touchdown run by Marquise Goodwin that tied the score, 14-14, with 9:41 remaining in the game.
That drive came with McCoy at quarterback in place of Ash, who completed 8-of-16 passes for 63 yards with two interceptions.
The Jayhawks responded with a 14-play drive, culminating in a 29-yard field goal from Prolago, who entered the game 0-for-1 on field-goal attempts in his career.
"We played our butts off on both sides of the ball," Weis said. "Physically, we more than held our own, and to lose with 12 seconds to go in a game is really disappointing."
Kansas gave Texas multiple chances, but the Longhorns couldn't capitalize.
The third quarter was particularly frustrating for the Longhorns, who couldn't score after the Jayhawks muffed a punt at their own 20-yard line.
Kansas thwarted that drive by stuffing Joe Bergeron on the one-yard-line, then dodged a bullet when Sims fumbled at the goal line.
Texas returned to the red zone on its next trip, but Lubbock Smith of Kansas intercepted a pass that deflected off the hands of Mike Davis on third down.
Kansas didn't start like a team primed for an upset.
The Jayhawks mishandled the opening kickoff, took a delay-of-game
penalty and allowed a sack on their first drive, setting up Texas at the Kansas 43-yard line.
...The Longhorns capitalized, getting a 31-yard run from Johnathan Gray on their first play from scrimmage and a three-yard touchdown run from Joe Bergeron for a 7-0 lead.
The Jayhawks answered by driving to the Texas five-yard line, but an errant snap and a sack derailed a scoring opportunity. Facing fourth-and-goal from the 29, Cummings launched a pass into the end zone that fell incomplete.
The Jayhawks appeared to be in more trouble after Texas downed a punt at the two-yard line, but Kansas responded with a 98-yard touchdown drive to tie the game.
Sims keyed the drive with a 64-yard run, followed by a 15-yard horse-collar penalty and a 15-yard touchdown run by Christian Matthews.
Kansas went ahead, 14-7, on an 11-yard touchdown run by Tony Pierson, and Greg Brown preserved the halftime lead by intercepting an underthrown pass thrown by Ash.
The Jayhawks amassed 177 rushing yards in the first half, including 139 on 14 carries for Sims.
NOTES: Big 12 Commissioner Bob Bowlsby was in attendance. ... Kansas running back James Sims topped 100 yards on the ground for a fourth consecutive game. ... Texas linebacker Jordan Hicks missed a fifth straight game because of injury. ... Freshman Damon Martin drew his first start at left guard in place of senior Duane Zlatnik for Kansas.