Ryan Thomson's late goal capped a fine comeback as Dunfermline beat Cowdenbeath at Central Park.
Jordan Morton had already hit a post for the hosts before Nathan Wedderburn fired them ahead from close range.
But the Pars hit back late in the first half.
Despite Ross Millen seeing his penalty brilliantly saved, he put the resulting corner straight onto the head of Callum Morris, who could not miss.
Declan O'Kane's header hit the post after 60 minutes, but five minutes later Ryan Ferguson swept home from six yards.
Thomson converted Craig Dargo's cross from the edge of the area after 80 minutes.
Cowdenbeath's afternoon got worse when Lewis Milne received a straight red card, while Wedderburn was stretchered off late on to leave them with nine men.