No. 8 Louisville led by three touchdowns midway through the third quarter. The Cardinals looked poised to move another step closer to a conference title and a possible undefeated season.
It all fell apart in a hurry for Teddy Bridgewater and Co.
Louisville's defense struggled in the second half and Central Florida scored 24 straight points during an impressive rally Friday night, leading to a 38-35 victory that ended the Cardinals' perfect start.
"We had our opportunities and we just didn't finish it," Louisville coach Charlie Strong said. "That was the first time we played bad on defense."
The timing couldn't have been worse.
Louisville (6-1, 2-1 American Athletic Conference) entered Friday's game with the nation's top scoring defense, allowing 7.3 points per game. Down 28-7 midway through the third quarter, the Knights (5-1, 2-0) responded with three touchdowns in a 7:22 span.
Louisville trailed for the first time this season after Shawn Moffitt hit a 34-yard field goal with 7:36 remaining.
The Cardinals then reclaimed the advantage 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 Blake Bortles' 2-yard touchdown throw to Jeff Godfrey with 23 seconds left.
"It's a reality check knowing that we're not invincible," Louisville linebacker Preston Brown said. "It hurts down deep knowing that we had the game in hand but we gave it away."
Bridgewater was 29 for 38 for 341 yards and two touchdowns in Louisville's first loss since Nov. 24 against Connecticut in overtime.
"You can't live in misery or live in a loss," Bridgewater said. "We are the type of team that has mature guys and I am pretty sure our guys are switching their focus to South Florida. One loss doesn't determine the whole season."
Bridgewater made one last desperate heave into the end zone as time expired, but the Heisman Trophy contender was unable to find anyone. The Knights then rushed the field in jubilation 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."
Bortles finished 21-of-32 passing for 250 yards and two touchdowns while Storm Johnson rushed 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. It also came in the lone conference meeting between the schools; The Cardinals are headed to the Atlantic Coast Conference next season.
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 welcomed back top receiver DeVante Parker from a shoulder injury, connecting for a 29-yard play on Louisville's opening drive. He also leaned heavily on former high school teammate Eli Rogers, who had 10 catches for 95 yards.
Bridgewater's 18-yard TD pass to Rogers gave Louisville a 7-0 lead in the first quarter.
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 reception helped prolong the 71-yard drive, but William 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 TD pass to Parker in double coverage just before halftime. The Cardinals then emerged from the locker room to drive 75 yards for a 21-7 lead on Dominique Brown's 20-yard touchdown run up the middle.
Preston Brown said the team will look to last year as an example of what it can still accomplish. After all, the Cardinals lost back-to-back Big East games last season and went on to win the league, the BCS bid and the Sugar Bowl with a victory against Florida.
"It just shows that anything can happen in this conference," Preston Brown said. "You know there are going to be losses, there are going to upsets, just as there was tonight. We've just got to keep at it, focus and get back to work on South Florida."