Darren Gribben set the Loons on the road to victory in the fifth minute when he got on the end of a Martin Cameron knock-down from a Ricky Waddell free-kick and scored from close range.
Alloa levelled within 90 seconds after Graeme Brown squeezed the ball inside the post.
Forfar created a number of chances and went ahead again three minutes before the interval when Paul Lunan showed great body strength to hold off a defender in the box and slot the ball home from 10 yards.
The second half saw Forfar enjoy the lion's share of possession.
Chances fell to Barry Sellars, who stung the fingers of keeper James Evans with a ferocious 35-yard free-kick and then David McClune, who was set up by Sellars only for his header back across goal to be saved by the keeper.
Gribben then squandered a glorious chance for Forfar when he was clear in the box, but he hurried his shot and blasted against the legs of the keeper.
But Alloa were never out of things, however, until substitute Jon Voigt put the seal on Forfar's win two minutes after coming on, forcing the ball home after his initial shot was blocked.