Expressions (phrases, clauses, etc.), Ichidan verb
to be contrary to one's expectations
自分の直感が、いかに確かなものか自慢した手前、当てがはずれた時は首をやらなければならなくなった。Having boasted how sure his hunches were, he was forced to eat his hat when he guessed wrong.
Also written 当てがはずれる【あてがはずれる】