In-form forward David Clarkson also scored for the visitors with Alexei Eremenko netting for Dundee.
The home side bossed possession early on with Eremenko causing problems for the visitors as he directed Kilmarnock’s attacks.
The Finland international came close to opening the scoring on the half-hour mark when he chipped just over the bar after getting on the end of Tope Obadeyi’s pass.
Martin Boyle went close for Dundee minutes later when his long-range strike crashed off the post.
Eremenko threatened again for the home side on 39 minutes when his right-footed strike from the edge of the box inched past the post.
The visitors took the lead just before the break when Stewart slotted Gary Harkins’ cross in off the post with his left foot.
Harkins set up Dundee’s second soon after half-time when he found Clarkson in the box and the in-form forward fired the ball into the bottom-right corner.
The home side pressed for a goal to cut the deficit and were rewarded on 77 minutes when Eremenko slotted home with his left foot from six yards out.
Killie almost equalised soon after when Eremenko sent in a good cross for Magennis, whose header was straight at Scott Bain.
Robbie Muirhead came close late on with a couple of efforts as Kilmarnock pressed hard for the equalising goal.
Stewart wrapped up the three points for the visitors in added time when he fired the ball into the top left corner from the centre of the box.