expression of surprise or delighted discovery, late 14c., from ah + ha.
This seely widewe and hire doughtres two ... cryden out "harrow!" and "weloway! A ha! þe fox!" and after him they ran [Chaucer]