Cyrus Gray rushed for 223 yards and had two long touchdowns, helping No. 17 Texas A&M beat Texas 24-17 on Thursday night, sending the Longhorns to their first losing season since 1997.

"We set out at the beginning of the season to do this," Texas A&M senior center Matt Allen said. "Beat Texas and win in November."

Gray had touchdown runs of 84 yards in the second quarter and 48 yards in the third. Von Miller intercepted a tipped pass at the Texas A&M 11 with 2:37 left to kill what looked like a drive for the tying touchdown.

Jeff Fuller also caught a touchdown pass and Randy Bullock kicked a 50-yard field goal for the Aggies (9-3, 6-2 Big 12), who won their sixth game in a row.

Texas' fifth home loss of the season kept the Longhorns (5-7, 2-6) from getting bowl-eligible just one season after playing for the national championship.

"From the first scrimmage of the year, I didn't see what I wanted," Texas coach Mack Brown said. "I learned I don't like losing. It's been 20 years since I haven't been to a bowl."

The Aggies still have a chance to win a share of the Big 12 South if Oklahoma beats Oklahoma State on Saturday. The Aggies would still be a long shot for the Big 12 championship game because of a tiebreaker based on BCS standings.

"Our fans want to be relevant and we are this year," said third-year Texas A&M coach Mike Sherman, who was 4-8 and 6-7 in his first two seasons. The Aggies have a chance to get their first 10-win season since 1998, when they won their only Big 12 championship.

Gray carried the Aggies to this victory. He is the first Texas A&M running back to reach 200 yards since 1995 and has six consecutive 100-yard games.

"He does things he has never done before each time he steps on the field," Sherman said.

Texas A&M scored 17 points off three Texas turnovers and led 24-14 after Gray's second touchdown. Texas kicked a field goal after a blocked punt and was driving toward a touchdown when Gilbert's pass was tipped at the line of scrimmage. Miller, a defensive end who drifted back into coverage, leaped high to grab it.

Texas A&M punted the ball back to Texas with about 10 seconds left and Ken Wood had to pick the snap off the ground to get it away. Texas tried to block it and freshman returner Adrian Phillips let the ball bounce on the ground.

That let the final seconds run out. The mistake was a fitting end to Texas' miserable season and several players threw up their hands in frustration.

Texas had never had a losing season under Brown but completely fell apart after quarterback Colt McCoy and a host of other players ended their careers. The Longhorns finished dead last in the Big 12 South and Gilbert's seven losses this season are one less than McCoy's four-year career.

"At this point, it's tough to look back on the entire year," Gilbert said. "No one in that locker room wants to feel what we're feeling right now."

The losses have intensified speculation among fans that Brown will replace one or more assistant coaches, including longtime offensive coordinator Greg Davis.

Davis has said he doesn't plan to retire.

"There's a lot of evaluation that has to be done on players, on coaches and staff," Brown said. "I've got a lot of work to do here."

Texas had a chance to win this one.

The Longhorns scored first on Gilbert's 31-yard touchdown pass to Marquise Goodwin, the wide receiver's first TD of the season.

Gilbert seemed to be gaining confidence with his arm and feet with every play, then made a huge mistake.

Texas recovered a fumbled punt and moved to the Texas A&M 8 before a botched handoff with Johnson caused a fumble. Two plays later, Gray swept to his right, cut back left, and was in the clear for an 84-yard touchdown run.

Gilbert threw an interception -- his 16th of the season -- on Texas' opening drive of the third quarter. He threw well behind wide receiver James Kirkendoll and Dustin Harris tipped the ball to himself on the Texas 38. The Aggies went ahead 10-7 on Bullock's field goal.

Fuller's touchdown catch made it 17-7 but the Aggies let Texas back in the game with another fumbled punt. Gilbert scored on a 1-yard run to pull Texas to 17-14 in the third.

Then Gray ripped off another big run.

And just like before, the Aggies got it right up the middle of the Texas defense. Ryan Tannehill faked a quick pass then turned to hand off to Gray, who took three steps and had open field to the end zone.

"We were so hungry all week," Gray said. "The guys wanted it more than anything else."