Hang it!

A rather old expression used to express annoyance or disappointment .

“Hang it,” the man said when he hit his finger with the hammer.