Scott Pittman pulled a goal back to set up a tense finale in which Livi had an appeal for a penalty turned down, but the Dons held firm.
The Dons had looked off the pace in their midweek win over St Johnstone and the first half of their clash with Livi offered more of the same, with little in the way of goalmouth action despite new signing Marley Watkins starting in attack.
Indeed, it was the visitors who looked the more threatening, with Shay Logan having to put in a timely challenge to deny Alan Forrest as the winger burst into the box after seven minutes.
Jonny Hayes saw an effort deflected wide soon after for the home side, who perhaps should have taken the lead on the half-hour as Matty Kennedy worked space on the left and pulled back for Ferguson, but his low shot was easily held by Robby McCrorie in the Livingston goal.
At the other end the visitors passed up an even better chance. Nicky Devlin robbed Kennedy and played in Scott Robinson who was denied by Joe Lewis.
The Dons took the lead in the 49th minute. Ferguson was bundled over in the penalty area by Craig Sibbald and picked himself up to fire emphatically into the top corner from the resultant spot-kick.
Ferguson blocked a Jack McMillan effort as the visitors sought a quick fire leveller, but Aberdeen doubled their lead six minutes later.
Ryan Hedges combined with Wright twice before the latter, now with only the goalkeeper to beat, slotted past McCrorie into the bottom corner.
McCrorie denied the home side a third with a stunning point-blank stop from Watkins' diving header, keeping Livingston in the game.
And they pulled a goal back after 69 minutes as Jack Fitzwater found space on the right to send in a teasing cross that was met at the back post by Pittman.
Livingston perhaps should have hand a penalty in the dying minutes as the Aberdeen defence failed to deal with Devlin's long throw and Logan appeared to handle in the ensuing stramash, but referee Steven McLean was unmoved by the claims.