Baylor trailed 19-10 early in the third quarter before Jay Finley ran 69 yards for a touchdown. Griffin then scored on a 1-yard touchdown and hit Kendall Wright with a 30-yard scoring pass in the fourth.
Baylor (7-2, 4-1) got its first win in Austin since 1991 and stays in first place in the Big 12 South. Texas (4-4, 2-3) looked in control when Garrett Gilbert scored on a 20-yard run in the third, but dropped its third consecutive home loss.
Finley rushed for 116 yards on 15 carries. Griffin passed for 219 yards and also had a 59-yard TD strike to Terrance Williams in the first half.
Justin Tucker tied a Texas record with five field goals.
Baylor came in ranked for the first time since 1993, but still in search of a win that would make them legitimate contenders for the South division title.
A second-half rally in Austin should prove the Bears are for real.
Baylor's defense kept Texas out of the end zone after long drives and came up with a big turnover that helped give Baylor the lead. On offense, Griffin & Co., just kept making the big plays.
And just like UCLA and Iowa State before them this season, the Bears sprinted to the corner of the end zone for visiting fans to celebrate what is probably the program's biggest win under third-year coach Art Briles.
Texas led 9-3 before Griffin hit Williams with the long TD strike in the second quarter. The pass only covered about 10 yards in the air but Williams made Texas safety Blake Gideon miss and had no one else to beat over the final 45 yards to the end zone.
Gilbert drove Texas to the go-ahead field goal before halftime and put Texas up by nine with his scrambling run for a touchdown on the first drive of the third.
But on Texas next' possession, a big hit on Greg Smith forced an interception by Antonio Johnson that set up Baylor inside the Texas 20. Baylor converted a fourth-and-1 on the Texas 2.
Griffin scored on the first play of the fourth quarter. The touchdown pass to Wright put the Bears up 30-19 with 8:38 to play.