Aberdeen attacker Duk came off the bench to set up the winner against Hearts in his first game action since going AWOL during the summer.