Foles, whose status for the game had been uncertain because of bruised ribs, tied the school record for career (64) and single-season (31) touchdown passes. He already held virtually all other passing records at the school. Foles also topped 4,000 yards passing for the season and 10,000 for his career.
Juron Criner caught nine passes for 129 yards and two touchdowns for the Wildcats (4-8), breaking the school career record for TD receptions at 32.
Blaine Gautier threw for 315 yards and a touchdown and ran for a score for the Ragin' Cajuns (8-4), who cut the Arizona lead to eight points three times in the fourth quarter.
Javon Lawson caught five passes for 137 yards for the Cajuns.
Gautier tied Jake Delhomme's school record of touchdown passes in a season at 20.
Louisiana-Lafayette tied an NCAA record when Jemarious Moten intercepted Foles' pass and returned it 41 yards for a touchdown early in the fourth quarter, the seventh pick-six of the season for the team. That tied a mark set by Tennessee in 1971.
The Cajuns of the Sun Belt Conference accepted a bid to the New Orleans Bowl on Monday, their first postseason appearance in 41 years.
Arizona (4-8) finished 3-3 under interim coach Tim Kish after Mike Stoops was fired halfway through the season. New coach Rich Rodriguez visited with tailgaters before the game and was introduced to the crowd at halftime.
Louisiana-Lafayette, 0-4 against Pac-12 teams, pulled within one possession for the final time when Gauthier scored on a 10-yard quarterback draw with 5:05 to play. But the Cajuns never got the ball again as Arizona moved downfield and ran out the clock.
Moten's TD return, on his second interception of the day, cut Arizona's lead to 31-23, but the Wildcats' Daniel Jenkins returned the ensuing kickoff 81 yards to the Louisiana 2. Two plays later, Keola Antolin scored on a 5-yard run to make it 38-23 with 13:28 left.
Again the Ragin' Cajuns came back, going 71 yards in 10 plays, with Alonzo Harris scoring on a 5-yard run to cut it to 38-30 with 10:26 still to go.
Foles' 35-yard pass to Criner at the 6:08 mark boosted the lead to 45-30.
The Cajuns used a fake punt and an onside kick in the first half, both of them successful, to take leads of 7-0 and 13-7.
Backup Bryson Bierne started in place of Foles, who was knocked out late in last week's 31-27 win at Arizona State. Bierne drove the Wildcats to the Louisiana 25, but his pass was intercepted by Moten, who returned it 19 yards to the Cajuns' 40.
Gautier's 40-yard pass to Lawson set up Harry Peoples' 11-yard TD run to make it 7-0. Foles came on for Arizona's second series and directed a 16-play, 80-yard scoring drive, with fullback Taimi Tutogi bulling in from the 1 on fourth down to tie it at 7-7.
After the kickoff, Louisiana-Lafayette faked a punt on fourth-and-11 from its 40, with punter Brett Baer throwing 13 yards to the Arizona 47. Ladarius Green's 20-yard run on a reverse set up Gautier's 4-yard touchdown pass to Alonzo Harris. Baer's conversion try bounced off the right upright and was no good, so the Ragin' Cajuns led 13-7 with 9:14 left in the half.
Foles threw two touchdown passes in a span of two minutes, 39 seconds late in the half to put Arizona up 21-13 at the break.
Jenkins' 34-yard run and a 24-yard pass to Criner set up Foles' 9-yard scoring pass to Criner that put Arizona up for good 14-13. On the second play after the subsequent kickoff, Gautier was hit by defenders from both sides and fumbled. Marquis Flowers recovered for the Wildcats at the Louisiana 32.
A roughing the passer penalty and four straight completions by Foles, the last 12 yards to David Douglas for a touchdown with 34 seconds left, put Arizona ahead 21-13.