After Jace Edwards scored on a 1-yard run for the Dukes, Justin Perillo caught an 8-yard pass from Warren Smith and the Black Bears used a special formation to go for the win.
Treister, a backup quarterback, took the snap with an option to pitch it or throw. He ran for the goal line, leaped and was hit twice in the air before landing in the end zone.
Maine (4-1, 2-0 Colonial Athletic Association) defeated James Madison (4-2, 2-1) for the first time since 2003.
Every time the Dukes scored, the Black Bears answered. Jordan Anderson, who had a career-high 212 yards on 26 carries, struck first with an 80-yard run.
Maine’s Brian Harvey tied it at 17 with a 34-yard field goal with 44 seconds left in regulation.