The home side had justifiable claims for a penalty waved aside four minutes later for what looked a blatant push in the area and they should have equalised after 34 minutes when Pablo Mills set up Adam Le Fondre who fired wide.
Three goals in 13 second-half minutes turned the game on its head. Nicky Law drilled a free-kick hard and low across the penalty area and Danny Harrison fired home in the 68th minute to make it 1-1.
Five minutes later Le Fondre made it five goals in as many starts. A free-kick was headed clear by the visiting defence but after Kevin Ellison nodded the ball back into the area the forward fired home from close range.
The points were secured when substitute Ryan Taylor's shot came back off a post with nine minutes remaining and Ellison followed up to knock the ball into the empty net.