BIRMINGHAM, Ala. -- The UAB Blazers rallied just when it seemed they might let another game slip away.
Ty Long kicked a 40-yard field goal with 21 seconds left to give UAB its first victory of the season Thursday night, 26-24 over Central Florida.
The Blazers (1-6, 1/3 Conference USA) converted two third-and-longs after taking over at their own 16 with 4:57 left to set up the game-winner.
They had dropped two games by five points or fewer and blew a nine-point lead in the fourth quarter this time before rebounding and finally getting something to celebrate.
"The satisfaction of winning a football game is mighty big for us," UAB coach Neil Callaway said.
The Knights (3-4, 1-2) got the ball across midfield with 14 seconds remaining on a kick return by Rannell Hall, whose returns helped set up all three TDs.
Backup quarterback Blake Bortles threw an incomplete pass and then had a last-play heave intercepted by Chase Daniel at the goal line.
"It feels so good to finally get that monkey off your back," said wide receiver Jackie Williams, who had 10 catches for 82 yards and ran for a fourth-quarter touchdown.
Bortles had led two fourth-quarter scoring drives after relieving Jeff Godfrey to rally the Knights from a 23-14 deficit, but couldn't keep UCF from losing for the fourth time in five games.
"I was just trying to get the first one out of the way," Perry said of the touchdown passes.
All those numbers were career highs, and his completions put him in a four-way tie for second-most in UAB history.
He has started three of the past four games with Ellis out with injuries.
The backup threw two interceptions in the end zone but came up big at the end -- with a little help from a timely flag.
Patrick Hearn caught a 22-yarder while falling backward on third-and-12 to push the Blazers across midfield. On third-and-16, Lyle Dankenbring was called for pass interference.
"We knew that we had to run as much time as we could off the clock," Callaway said. "And the play with Pat Hearn making a heck of a catch on their sideline put us in great position for the field goal."
Long split the uprights after three straight runs by Darrin Reaves. UCF had taken the lead on Shawn Moffitt's 24-yard field goal.
UAB gained 501 yards against the nation's No. 3 defense while holding UCF to 331. Perry also ran for 33 yards on eight carries, while Reaves gained 83 yards.
"I think it's as sloppy defense as I've ever seen just as far as making plays," UCF coach George O'Leary said. "The coverage wasn't good and things you can't do in games and expect to win. Disappointing."
The Knights lost the time of possession battle for the first time this season, holding onto the ball for nearly 10 minutes less than their average of 35 minutes, 30 seconds.
The Blazers' first win didn't come without plenty of tense moments.
The Knights came right back after O'Leary inserted Bortles in the fourth quarter. Hall put him in good position for his first drive by returning a squib kick 39 yards to the UAB 41.
Bortles then completed his first four passes before Latavius Murray ran for the final yard to cut the gap.
Bortles passed this time to Murray, who made a nice cutback move en route to a 53-yard gain to set up a first-and-goal from the 6 for UCF on the next drive.
One run went nowhere and Bortles threw two incompletions to force Moffett's kick.
"I thought we should have put Blake in sooner," O'Leary said. "Obviously he had a little better grasp of what was going on out there."
Godfrey was 13 of 22 for 133 yards and an interception and directed touchdown drives on UCF's first two possessions, capped by leading rusher Brynn Harvey's first touchdowns of the season. Bortles was 6 of 10 for 102 yards, all in the final quarter.
The Blazers were also playing without injured tailback Pat Shed and an ailing left tackle Matt McCants.
Jackie Williams scored on a 4-yard end around on third-and-goal for the nine-point lead in the opening minute of the fourth.
Then the UCF defense came up big. Troy Davis and Kemal Ishmael stuffed Perry on fourth-and-2 from the UCF 32 midway through the fourth.
That set up the go-ahead field goal.
Long had given UAB a 16-14 halftime lead with a 45-yard field goal on the final play after Perry took over with 34 seconds left. He delivered a 25-yard pass to Nolen Smith and a 12-yarder to Williams to move into field goal position.
UCF had also missed a field goal in the half.
West Virginia has what looks to be a tough schedule, but three of its stiffest Big 12 challenges -- against Oklahoma, TCU, and Baylor -- come at home.
UCF wants to leave Michigan with its dignity intact, but a date with Maryland provides a chance to show the Knights' 2015 season was a fluke.
In 1998, Mike Riley suspended two Oregon State players one game for their involvement in the sexual assault of Brenda Tracy. This week, Tracy met with Riley and his football team to share how that assault has affected the last 18 years of her life.
There are several candidates expected to have an enormous impact on their new programs. Keep an eye on Trevor Knight, Chris Black and Luke Del Rio.
The atmosphere at Auburn's Jordan-Hare Stadium and potential implications on the national stage set the Clemson-Auburn matchup apart.
The Golden Bears have to replace Jared Goff and a bevy of receivers, but hopes are high for Texas Tech transfer Davis Webb and the new WRs.