Casual, emphatic exclamation of shock, dismay, or frustration. A contraction of なんてことだ. Often used by male speakers.
なんてこった!財布を忘れた。
Oh no! I forgot my wallet.
なんてこった、また雨かよ。
Damn, rain again?
くそ is a blunt, vulgar curse used on its own, while 何てこった is a fuller exclamatory phrase expressing disbelief.
Contraction of なんてことだ (nante koto da), literally 'what a thing it is'.