LOUISVILLE, Ky. - Blake Bortles and UCF had one last rally left, and it was enough to topple Teddy Bridgewater and No.8 Louisville.
Bortles threw a 2-yard touchdown to Jeff Godfrey with 23 seconds left and the Knights earned the biggest victory in program history, stunning the Cardinals 38-35 Friday night and ending Louisville's perfect start.
Down 28-7 midway through the third quarter, the Knights (5-1, 2-0 American Athletic Conference) scored three touchdowns in 7:22 to tie it. Miami transfer Storm Johnson had a 1-yard TD run and a 20-yard reception for another score, and William Stanback ran 12 yards for the tying touchdown.
UCF then went in front on Shawn Moffitt's 34-yard field goal with 7:36 left.
Louisville (6-1, 2-1) reclaimed the lead on Dominique Brown's 15-yard run with three minutes to go, but the Knights drove 75 yards in 11 plays to take the lead for good on Bortles' touchdown, then held off the Cardinals' comeback.
Bridgewater made one last desperate heave to the end zone as time expired, but the Heisman Trophy contender could not find anyone.
The Knights rushed the field in jubilation after their first win over a top-10 team as a small gathering of fans in one section chanted "UCF, UCF!"
"What can you say? It was a heck of a game," Knights coach George O'Leary said. "Both teams played their hearts out. That was a great drive, and it was a great win in a tough environment.
"Obviously, it's a big win. It's a big win because of the conference. We had great effort and great execution. ... We could have hung our heads, but we got after it."
Having beaten the preseason league favorite, UCF is tied with USF and Houston at the top of the American. This is Louisville's only season in the American; the school is leaving for the ACC after this season.
Bortles finished 21-of-32 for 250 yards and two touchdowns, and Johnson ran for 109 yards and a TD on 18 carries, leading a spirited comeback during which the Knights outgained the Cardinals 269-210 in the second half to finish with a 446-445 edge.
It was Central Florida's second win over a ranked team in 27 attempts. The other was against No. 13 Houston in 2009.
Struggling against a defense that entered the game allowing a nation-best 7.3 points per game, UCF found room to run when Johnson started to cut and bounce his way to extra yardage.
Bortles chipped in with crisp passing, especially on the 20-yard pass to Johnson after a fumble recovery on the Cardinals 15.
The combination of Johnson and Bortles ruined Louisville's homecoming and its 100th game at Papa John's Cardinal Stadium before a crowd of 55,215.
Bridgewater finished 29-of-38 for 341 yards and two touchdowns. He welcomed back top receiver DeVante Parker from a shoulder injury, connecting for a 29-yard pass on Louisville's opening drive.
Bridgewater also went to former high school teammate Eli Rogers, who caught five passes for 44 yards, including an 18-yard touchdown that gave Louisville a 7-0 lead.
Ryan Hubbell's fumble that hit the pylon for a touchback and a punt on the next drive prevented the Cardinals from expanding the lead, and UCF scored on its fifth possession.
Johnson's 23-yard catch helped prolong the 71-yard drive, but Stanback's recovery of Rannell Hall's fumble at the 4 turned out to be the key play. Stanback scored on the next play.
Louisville responded with a 10-play, 75-yard drive ending with Bridgewater's 10-yard touchdown pass to Parker in double coverage just before halftime. The Cardinals scored 21 in the third quarter before UCF's rally began.