Allen connected with undrafted free-agent wide receiver Robert Foster for a 42-yard touchdown, which proved to be the game-winner, early in the fourth quarter.
Earlier in the second quarter, Allen ran three yards to give the Bills a 7-6 lead.
Allen completed 13-of-26 pass attempts for 204 yards and the one score to Foster. He also rushed nine times for just 16 yards.
Foster finished with four receptions for 108 yards to lead Buffalo (5-9).
Detroit (5-9) was eliminated from playoff contention with the loss. Matthew Stafford went 22-of-29 for 208 yards and one touchdown.
After a scoreless first quarter, the Lions drew first blood when Stafford directed a nine-play, 75-yard drive that culminated with a four-yard scoring pass to Andy Jones. A botched snap doomed the Lions' extra-point attempt.
Allen answered, taking less than three minutes to direct a five-play, 87-yard drive that put Buffalo ahead, 7-6. The rookie quarterback took it the final three yards for the score.
Not to be outdone, Stafford engineered a 77-yard drive with Zenner bursting in for a score. Matt Prater's extra point was good this time for a Detroit 13-7 lead.
The score would remain the same until Allen found Foster for the game-winner.
Stafford did drive the Lions on the next possession into field-goal territory, but Prater's 48-yard attempt to give the Lions the lead was wide right.