With 2:28 left and the Jayhawks (1-7, 0-5 Big 12) straining to end a 16-game Big 12 losing streak, Nick Prolago kicked a 29-yard field goal for a 17-14 lead over a Longhorns squad that came in as three-touchdown favorites.
But McCoy, who replaced an ineffective David Ash in the fourth quarter, quickly had the Longhorns (6-2, 3-2) soaring down the field.
On third-and-goal from the 1 and with Kansas crowding the line of scrimmage, Grant sneaked into the end zone and cradled McCoy's softly tossed pass for the winning TD.
James Sims rushed for 178 yards and became the first Kansas player with four straight 100-yard games since Tony Sands in 1991. The Jayhawks, who fell to 0-10 against Texas since the Big 12 was formed, rushed for 234 yards altogether against a Texas defense that was ranked 107th in the country against the run. Freshman quarterback Michael Cummings did not attempt a pass in the second and third quarters and was only 3 of 9 for 39 yards.
The Longhorns tied it at 14 on an 11-yard run by Marquise Goodwin following his 41-yard run on an end-around in the fourth quarter.
Sims, who came into the game second in the Big 12 with an average of 111.5 yards rushing per game, had 139 yards in the first two quarters. In the second quarter, facing a first down on their own 2, the Jayhawks stunned the visitors by breaking Sims through the middle for a 64-yard gallop, Kansas' longest run in six years. Adding 15 yards for a personal-foul penalty against the Longhorns gave Kansas a first down on the Texas 15. On third down, Matthews went through a big hole on the left side to make it 7-7.
In Kansas' second TD drive of the second quarter, Sims ripped off a 20-yard gain through the middle and Pierson went wide left for 18. On first down from the Texas 11, Pierson went right, then cut back through a big hole and practically walked into the end zone to put the Jayhawks on top 14-7.
Texas took a 7-0 lead in just four plays on its first possession when Joe Bergeron dragged would-be tacklers 3 yards into the end zone.
Johnathan Gray, who totaled 111 yards rushing, ran for 31 to the Kansas 12 on Texas' first play from scrimmage. But the Longhorns' next four possessions ended in punts, and their fifth came to a halt whenGreg Brown intercepted Ash's underthrown pass at the Kansas 11.
The Longhorns punted again on their first possession of the second half, but Bradley McDougald muffed the punt and Josh Turner recovered for Texas on the Kansas 19. But on fourth-and-goal from the 2, Bergeron was stopped by Ben Heeney and Huldon Tharp.
After forcing another punt, the Longhorns again started in Kansas territory. But on third-and-7 from the 17,Lubbock Smith intercepted a poorly thrown pass that was deflected right into his arms.