Brechin attacked from the start and Graham Gibson headed over. Then Craig Winter shot against the post.
It was no surprise when Brechin opened the scoring after 17 minutes. Kevin McLeish crossed from the right and Paul Ritchie headed home.
Alloa went close to an equaliser after 22 minutes when a shot from Richard Walker sneaked through a crowd of players and came back off the post.
Brechin went close again when Steven Hampshire linked brilliantly with Grant Johnson and scooped a shot over the bar.
The home pressure continued and McLeish swerved a shot just wide.Then Steven Hampshire forced a great save from James Evans.
Alloa equalised three minutes into the second half when Richard Walker was fouled by Scott Walker and Brown Ferguson scored from the spot.
Brechin hit back and regained the lead after 69 minutes. Gibson had a shot blocked but followed up to fire the rebound into the net.
Battling Alloa equalised again in the 72nd minute. A Stuart Callaghan corner was headed on and Ross Hamilton headed home.
Alloa then stunned Brechin by grabbing a winning goal three minutes from time when Michael Bolochoweckyj headed home a James Stevenson free-kick.