A game that can best be described as a performance of two halves from Peterhead saw them make it six wins from the last seven matches and move up to third in League Two.
The win puts them within striking distance of leaders Stirling Albion who they meet at Forthbank on Tuseday night.
A goalless first half in which the visitors looked more impressive and the Blue Toon mostly flat and lacklustre, was turned on its head virtually from the restart with a penalty and a sending off that were to prove the pivotal moments.
City attacked from off and earned a corner in the opening minute which caused panic in the home ranks but was eventually scrambled clear.
After nine minutes the visitors attacked with pace once again, this time Lewis Allan fizzed a low cross in from the right and Farid El Alagui saw his goal bound shot blocked by Jason Brown at the corner of the six yard box.
On the quarter hour a quiet Peterhead finally came to life with Simon Ferry squaring for Russell McLean but his effort was blocked by Jordan Caddow only for former Aberdeen player Josh Walker to try his luck from distance ten minutes later as the lowly visitors continued to impress.
In the 38th minute Rory McAllister should and normally would have scored after rounding keeper Calum Antell but as he was about to stroke the ball into the empty net Marc Laird nipped the ball clear.
The second half burst into life two minutes after the restart. McAllister was fouled in the act of shooting a yard inside the box and as if that wasn’t bad enough for City, the perpetrator, Chris McKee was sent off for denying a goalscoring opportunity with McAllister burying the resultant spot kick low into the bottom right corner.
It should have been game over after 62 minutes, a dreadful long distance pass back from veteran Craig Beattie sent McAllister clear but he didn’t get enough on his attempted lob over keeper Ansell who easily clutched the ball above his head.
Ten minutes later though it was two nil, a ball forward from midfield picked out McAllister who made no mistake this time stabbing the ball low past Ansell from six yards for his 20th of the season.
Another two minutes later and sub Jordan Brown made the victory safe pouncing from point blank range after a mis-hit Jack Leitch shot was only partially saved.
There should have been another four minutes from time but substitute Allan Smith blazed over and going on a mazy run into the area but the win will send the Blue Toon into the game in Stirling in fine fettle where a victory would send them top of the Division Two table.
Peterhead manager Jim McInally (inset) said: “I’m happy with the win and I thought we deserved to win but the margin flattered us.
“We could have played better but I think there is more to come from the team. It’s a pleasing result.
“We will go down to Stirling in good heart. We still owe them for the result up here and that is still raw but we will go there in a confident mood knowing a win will keep us right in there.”