Hearts endured a frustrating end to a difficult week as Jamie Hamill's late own goal meant they drew at Aberdeen.