Longhorns dodge predicted doom, defeat Red Raiders 31-22