Aberdeen led from the first minute in their vital Scottish Premiership match against relegation rivals Kilmarnock but had to hold on for a 1-0 win in a game that saw the home side's crossbar struck three times.