Green’s Dictionary of Slang

what the Hampton Court...? phr.

[euph., via the initial ‘h’, for what the hell...? phr.]

[late 19C] an excl. of surprise, shock, alarm or resignation etc.