BIRMINGHAM, Ala. -- UAB mustered one clock-eating scoring drive and then stopped two slightly more frantic end-of-game efforts by Southern Mississippi (No. 20 BCS, No. 22 AP).

Ty Long kicked a 38-yard field goal with 3:04 left after a drive that consumed nearly half of the final quarter, giving the Blazers a 34-31 upset victory over Southern Mississippi on Thursday night.

The Blazers (3-8, 3-5 Conference USA) earned their second victory against a ranked team, having beaten No. 17 East Carolina 36-17 in 1999. UAB was more than a three-touchdown underdog in this one, fell down 14 points in the first 4 minutes and was victimized for TDs after a fake field goal and a successful onside kick.

"We don't get down. We just kind of roll," Blazers coach Neil Callaway said. "Obviously, that's not a good way to start. But you've got the (two) turnovers, you've got the fake kick, you've got all those things. We give up some yardage but we kind of find a way to keep them out of the end zone."

The Golden Eagles (9-2, 5-2) pushed the ball across midfield twice in the final minutes but Austin Davis' fourth-down pass was broken up by Jamie Bender. Davis' run for what would have been a first down was negated by Jason Weaver's chop block, setting up third-and-20 from the Southern Miss 41.

UAB ran the clock down to 11 seconds before punting. The Golden Eagles had five laterals before the final play ended inside the Blazers 40 with 292-pound lineman Joe Duhon bumped out of bounds after rumbling the final 27 yards.

Southern Miss, which had won its last eight games, can still secure the East Division title and a spot in the C-USA championship game with a win over Memphis.

"They played better than we did," Golden Eagles coach Larry Fedora said. "We got outcoached. I got outcoached and they did a better job than we did. They had their players ready to play and I didn't have my guys ready to play, obviously.

"They knew what was at stake, they knew what had to be done. They knew we hadn't changed anything from the first week to this week, and it's my job to figure out why they weren't ready."

Jonathan Perry completed 17 of 26 passes for 236 yards and a touchdown and ran for another score for the Blazers. Greg Franklin gained 85 yards on 17 carries.

Davis was 20 of 29 passing for 264 yards and touchdowns of 34 and 38 yards and threw one interception. Jamal Woodyard ran 10 times for 95 yards and Southern Miss outgained UAB 523-425.

UAB has won three straight against Southern Miss after losing the first nine in the series. Eight of the 12 have been decided by seven points or less.

"Every time we play them, I just want to beat them," said Blazers cornerback Marquis Coleman, who set up a first-half touchdown with an interception. "I guess everybody on the team took that mentality and we showed everyone that we can beat whomever no matter what their record is."

That preserved Long's second game-winner out of the Blazers' three victories. He also booted a 40-yarder with 21 seconds left to beat Central Florida.

The Blazers had been set up for more points on that go-ahead drive.

Perry hit a leaping Patrick Hearn for a 32-yard pass on third down to push the ball down to the 10-yard line. UAB lost yardage on each of the next three plays, though, including a pair of shotgun snaps bobbled by Perry.

The teams traded short touchdown runs in the opening five minutes of the fourth quarter, keeping the game tied.

Perry set up Franklin's 3-yarder with a 31-yard pass to Nick Adams and two straight quarterback draws covering 22 yards. Davis tied it again with a 1-yard sneak on fourth down with 10:27 left.

The Blazers didn't give the ball back until they'd recaptured the lead with a drive consuming 7 minutes, 14 seconds.

Southern Miss squandered two scoring chances. First, Woodyard fumbled on the UAB 8 in the second quarter. Then, Danny Hrapmann missed a 37-yard field goal in the third that squandered a 15-play drive.

The Blazers overcame two successful gambles by Southern Miss coach Larry Fedora to claim a 24-21 halftime lead after Long booted a 29-yard field goal with 19 seconds left to punctuate a 14-play drive.

Southern Miss converted an onside kick and a fake field goal into touchdowns, but both teams had a pair of turnovers.

Davis threw touchdown passes to Balentine and Kelvin Bolden in the first 3:30, aided by the onside kick after the first score.

Fedora struck again when holder Peter Boehme scooped up the ball and hit tight end Ryan Hanks for a 10-yard touchdown on the fake.

"I would hate to go back and say I wish we didn't score 14 points so that we are not relaxed," Fedora said. "We basically didn't have what it took tonight to win the football game."