Former Derby County frontman Deon Burton was Allen's third and final change and he showed why his manager turned to him with a superb turn and finish in stoppage time.
The game had appeared set for a draw after Morecambe's own sub Jack Redshaw cancelled out Lewis Montrose's first-half opener.
And Allen, whose side are now seven points clear at the top, said: "To have people like Deon Burton, Myles Weston and Charlie Allen on the bench - what a difference they all make when they come on.
"In modern football your subs have to be quality, they have to be powerful, and thankfully we've got them here. What a finish from Deon. I've seen him do that for years, and it was an amazing end to what was a very difficult game.
"We started extremely well, but Morecambe have being playing well recently, and are well organised with real men on their team. They're getting stronger and stronger with a good blend of young and old players. I give every one of them full respect."