The catch by Allen came moments after Will Oliver connected on a 22-yard field goal in overtime for Colorado, his fourth of the game. Oliver also nailed a 32-yarder with 30 seconds remaining to extend the game for the Buffaloes (0-2).
Paul Richardson caught 11 passes for a school-record 284 yards to help Colorado rally from a 10-point deficit in the second half. The speedy wideout grabbed two TD passes from Tyler Hansen, who finished with a team-record 474 yards passing.
The game won't count in the Pac-12 Conference standings because it was scheduled as part of a home-and-home series before the Buffs bolted from the Big 12. But it may have just given the Buffs an early preview of what may be in store during league play.
Cal, making its first trip to Folsom Field since 1982, was outgained 582-370.
The victory was Jeff Tedford's 74th as Cal coach, tying him with Andy Smith (1916-25) for most in school history.
But it wouldn't come easy.
The Bears faced a first-and-30 at the 35 in overtime, but Maynard completed a pass to Allen near the goal line. Two plays later, the tandem hooked up again for the game winner.
Richardson's performance easily eclipsed the Colorado record of 222 yards set by Walter Stanley in 1981 and matched by Rae Carruth in 1996.
It could've been even more, but Richardson was overthrown on several occasions after breaking free of coverage.
Richardson's biggest catch came late in the third quarter, when he took a pass from Hansen, shed a tackler and raced 66 yards for a TD to pull the Buffaloes to within 23-20. He added a 78-yard score to give the Buffs a 27-23 lead.
Once Anderson's score gave the Bears the lead back with 9:55 remaining, Cal cornerback Steve Williams found a way to bottle up Richardson, knocking down two crucial passes late in the contest.
Hansen became the first quarterback to throw for more than 400 yards against the Bears since Alex Brink of Washington State had 421 yards on Oct. 22, 2005.
The Buffaloes opened the second half with a long scoring drive, culminating with tight end Ryan Deehan's 37-yard TD catch on a coverage breakdown by the Bears.
To keep the drive going, Colorado converted a fourth-and-1 at its own 29 on Hansen's QB sneak.
Oliver staked Colorado to a 3-0 lead after connecting on a 27-yard field goal in the first quarter. In five previous meetings, the team that scored first never relinquished the lead. But that trend was quickly halted Saturday.
Cal jumped right back in front when Maynard marched the Bears down the field and hit fullback Nico Dumont for a 2-yard score. Giorgio Tavecchio's extra point was blocked.
Just before halftime, Miller hauled in a one-handed grab in the end zone to help the Bears to a 16-6 lead.