Stirling secured runners-up spot in Premier Sports Cup Group A but just missed out on a place in the last 16 as one of the three best second-placed sides.
The Binos had already beaten Cove Rangers and Inverness CT, the latter on penalties, before losing to Hearts in midweek and earned a deserved victory in front of 273 fans.
Peterhead have an excellent record at Forthbank in recent years but paid the price for some poor defending as Stirling came out on top in a game that saw water breaks in both halves.
Albion went ahead after just six minutes when defender Jordan McGregor powered in a header from a corner but McGregor then conceded a penalty less than a minute later, bring down Hamish Ritchie, and Scott Brown equalised from the spot.
The home side were back in front after 12 minutes following another corner. Nathan Flanagan’s delivery from the right carried to the back post and left-back Martin McNiff scored from close range.
Jack Leitch forced a great save from Lenny Wilson after being picked out by Ross McGeachie but the midfielder did find the net against his former club two minutes into the second half when he found the bottom corner with a superb strike from outside the box.
Peterhead tried to hit back and substitute Derek Lyle had a header ruled out for offside while winger Nathan Flanagan should have added a fourth goal for Stirling but was denied by the keeper.
Stirling Albion: Currie, McGeachie (Grant 82), McNiff, Cummins, McGregor, Laird (Banner 65), Carrick (Moore 54), Omar (Roberts 65), Leitch, Flanagan, Mackin (Bikey 82). Subs (not used): Law (GK), Summers, Heaver, Greenhorn.
Goals: McGregor 6, McNiff 12, Leitch 47
Peterhead: Wilson, Conroy, McDonald, Jason Brown (Mushanu 77), Strachan, Ritchie, S Brown, Kesson (Lyle 59), Mulligan, Payne, Jordon Brown (Cameron 59). Subs (not used): Long (GK), Cook, Ferry.
Goal: Scott Brown pen 7
Referee: Barry Cook