Tyrone Swoopes had just thrown his second touchdown pass to put Texas ahead late when the Longhorns recovered a fumble.
Just a couple of first downs and the Longhorns would have a huge upset only three games into coach Charlie Strong's tenure, and a week after a humiliating loss at home.
But the Longhorns gave the ball right back, UCLA set up backup quarterback Jerry Neuheisel's second touchdown pass with a long punt return and the Bruins pulled out a 20-17 victory Saturday night in a game that started with a big blunder by Texas.
"For a minute there, we felt like we had finally broke through that wall, but it seems like the luck just doesn't keep coming to our side," said John Harris, whose 8-yard TD catch with 5:13 left put the Longhorns up 17-13.
"We didn't win. It hurts. They all feel the same," running back Malcolm Brown said. "We still took a loss. We have to go out and get better."
The game-winning score for UCLA (3-0) was Neuheisel's 33-yard TD pass to Jordan Payton with 3 minutes left, on the first play after a 58-yard punt return by Ishmael Adams with the assist of a crushing open-field block by Cameron Judge.
Neuheisel, the third-year sophomore and son of the former UCLA coach, completed 23 of 30 passes for 178 yards after Brett Hundley injured his left elbow in the first quarter.
"It took until I got in the locker room and we did the fight song that it really sank in," Neuheisel said. "I know tomorrow I'll be able to tell you every single play I ran and every single throw I had and every mistake I made. Right now I'm just kind of on cloud nine and enjoying the moment."
After the Swoopes-to-Harris TD and recovered fumble, the Longhorns (1-2) went three-and-out before punting the ball to Adams.
Swoopes threw for 196 yards and two touchdowns in his second start for concussion-plagued David Ash.
The Bruins got the ball to start both halves after Texas botched the opening coin toss.
UCLA won the coin toss and elected to defer its choice until the second half, then Texas said it wanted to go on defense. The referee turned off his microphone and briefly said something to the Longhorns players after their decision.
"I think what happened is that one of our guys got nervous," said Strong, who was told by the player that he "just got so hyped up."
When the Bruins unexpectedly got the ball to start the game, they got one first down before stalling at midfield and punting. On the expected opening drive of the second half, they went 75 yards on seven plays for a game-tying 3-yard TD pass from Neuheisel to Nate Iese.
Paul Perkins had 126 yards on 24 carries for the Bruins, and caught five passes for 69 yards. Ka'imi Fairbairn had field goals of 47 and 25 yards.
Hundley got hurt on UCLA's second offensive possession, at the end of an 11-yard run to convert a third-and-9. He appeared to land awkwardly on his left arm when he reached down while being tackled at the Bruins 35.
Texas fans in burnt orange were the majority in the announced crowd of 60,479 for the neutral site game played at the $1.2 billion Dallas Cowboys' home stadium, only three hours from their Austin campus and the site of the national championship game in four months.
But there were still a lot of empty seats a week after the Longhorns' 41-7 home loss to BYU that Strong described as embarrassing and humiliating.
"I like how we battled. ... I just like overall how this team bounced back from a week ago," Strong said. "I just told them to keep fighting, keep battling and good things are going to happen and these close games we'll be able to win. It's hard right now. It's tough in that locker room. They laid it out there and gave everything they had."