Wisconsin's Brooks Bollinger threw two touchdown passes and ran for the tying score with 51 seconds left in regulation. The Badgers (8-6) improved to 7-1 in bowl games under coach Barry Alvarez.
Allen, a walk-on, had to shake some jitters before his winning kick.
"I haven't been automatic from 37," said Allen, who was 11-of-18 this season with a long of 48 yards. "Luckily today I was."
Colorado (9-5) got the ball first in overtime but lost 2 yards on three plays before Patrick Brougham missed a 45-yard field goal attempt.
Wisconsin then gained 5 yards on three straight runs to set up the winning kick by Allen, who was mobbed by his teammates on the field.
"How 'bout them Badgers!" Alvarez yelled to the Wisconsin fans as the Badgers celebrated the win amid hundreds of multicolored balloons and confetti dropped from the Alamodome ceiling.
Bollinger passed for 163 yards and ran for 82 more in the senior's eighth career fourth-quarter comeback.
"No question about it, this program needed this so bad," Bollinger said. "Especially for the young kids, to point this program in the right direction."
Wisconsin started the season 5-0 before fading badly down the stretch.
Chris Brown rushed for 97 yards and a touchdown on an Alamo Bowl-record 28 carries for Colorado.
Brown, who rushed for 1,744 yards during the season but missed the last two games with a bruised sternum, also missed most of the fourth quarter with a mild concussion.
Don Strickland set an Alamo Bowl record with a 91-yard interception return and D.J. Hackett caught two touchdown passes.
Colorado starting quarterback Robert Hodge threw a touchdown and three interceptions in the first half before he was lifted late in the second quarter for Zac Colvin.
Colorado badly missed Brown as it tried to nurse a 28-21 lead after Colvin threw an 11-yard TD pass to Hackett in the third.
Wisconsin, which ranked second in the nation in turnover ratio, nearly gave the game away with four against Colorado.
The Badgers led 21-14 before a pair of fumbles changed momentum in the third.
Leonhard's Big Ten record-tying 11th interception of the season set up Brandon Williams' 10-yard touchdown catch from Bollinger.
"This was the best game of my life," Leonhard said. "It just proves the character of this team."
Bollinger's 7-yard pass to Darrin Charles gave Wisconsin a 21-14 lead.
Brown took a while to get cranked up. He had just 34 yards in the first half against a gang-tackling Wisconsin defense that bottled him up three and four at a time.
He finally got untracked in the third after Wisconsin's first fumble gave Colorado the ball on the Badgers' 25.
Brown carried seven straight times before bowling over three defenders on a 4-yard TD that tied the game.