Despite the win the Dons will be concerned by the loss of Cosgrove – now on 16 goals in all competitions – 20 minutes into the second half.
Killie were without suspended centre-back Alex Bruce, with captain Gary Dicker lining up at the back rather than in his usual central midfield role.
And it was he who was dropped by Main, as the former Motherwell man found space in the area to power a diving header beyond Laurentiu Branescu from Lewis Ferguson's cross after just 10 minutes.
Having come under pressure following heavy defeats to both sides of the Old Firm in recent weeks, off the back of an inconsistent start to the season, the early goal came as something of a relief for the Dons and gave them something to build on.
They got their reward when Cosgrove saw his shot deflected away for a corner after 26 minutes following a neat combination with Main.
Ryan Hedges played the resultant set-piece short to Niall McGinn, and his cross to the back post was powered in by the head of Cosgrove despite the best efforts of Branescu.
For their part Kilmarnock were always keen to push forward, but the home defence largely kept them at arm's length, with Rory McKenzie twice forcing Joe Lewis into diving saves from outside the area, the latter the final action of the first half.
They were back on the attack in the opening stages of the second half, with Stephen O'Donnell's strike easy for Lewis to deal with at his near post, but Aberdeen swiftly countered and Cosgrove was unlucky to see his powerful 18-yard strike come back off an upright.
Cosgrove's injury did little to affect his side, however, with his replacement Connor McLennan forcing two fine saves from Branescu within two minutes of his introduction.
Indeed, it seemed that the home side were keen to put the game beyond doubt, and Ferguson was unlucky to see his brilliant run into the area end with his shot turned away for a corner.
But they got a deserved third goal with nine minutes remaining, as McKenna powered home at the back post after Greg Leigh had flicked on McLennan's corner.