Aberdeen missed the chance to go within two points of Celtic at the top of the Scottish Premiership after they lost 2-1 to Hearts.