A superb second-half display for Peterhead saw them earn only their third league win of the season.
The two teams were closely matched in the first half, but it was the visitors who took the lead after 38 minutes. Home keeper Paul Mathers was alleged to have brought down David McGeown and Jamie Stevenson struck an immaculate penalty.
Peterhead had chances of their own. Martin Bavidge led the line well after returning from injury but lasted only 12 minutes before being carried off with an Achilles injury.
Man-of-the- match Bobby Linn crashed a 25-yard free-kick off the cross bar just before half-time, but he made no mistake two minutes after the re-start. He raced clear following a pass by Alan Youngson and calmly shot low into the left side of the goal.
Four minutes later Linn scored his second with another cool finish, this time from a pass by substitute Martin Wood.
Alloa lost their discipline soon after Peterhead's second goal and three players were booked followed by a straight red for defender Steven Learmonth for using his elbow in a challenge with Chris Hegarty.
Peterhead made the game safe with a third goal after 63 minutes, Keith Gibson scoring from close range following a Jamie Buchan corner kick.