Aberdeen endured a fifth Scottish Premiership game at Pittodrie without a win after being stunned by struggling Hamilton Academical.