Gauss, in his Disquisitiones, used ad hoc notation for the class number when he needed it. He did not use h. Dirichlet used h for the class number in 1838 when he proved the class number formula for binary quadratic forms. I somewhat doubt that he was thinking of "Hauptform" in this connection - back then, the group structure was not as omnipresent as it is today, and the result that $Q^h$ is the principal form was known (and written additively), but did not play any role. Kummer, 10 years later, used H for the class number of the field of p-th roots of unity, and h for the class number of a subfield generated by Gaussiam periods (and "proved" that $h \mid H$); in the introduction he quotes Dirichlet's work on forms at length.
In the Grothendieck-Serre correspondence, you can find some interesting quotes:
[GROTHENDIECK, OCTOBER 19, 1961]
"Je trouve que ce n'est pas malin de faire laïusser Néron sur lui-même: on ne sera pas plus avancé après qu'avant. Ne pourrait-on pas essayer de trouver un brave qui essaierait de comprendre un peu ce que fait Néron? Peut-être une série d'exposés sur Néron-Kodaira-Ogg-Tate, par Cartier ou quelque autre, puisque tout cela est lié et devrait être compris ensemble."
("I do not think it is very smart to let Néron talk about himself: we will be no better off afterwards than we were before. Couldn't we try to find someone coureageous enough to try to understand what Néron is doing? Maybe we could have a series of talks by Cartier or someone else, on Néron-Kodaira-Ogg-Tate, since all this is linked, and should be understood together".)
[SERRE, AUGUST 13, 1964]
"Il faudrait que tu m'expliques une fois ce que sont ces symboles locaux de Néron. Je n'ai rien compris à ce que Lang en disait - et je n'avais pas compris davantage le papier de Néron que j'ai eu une fois entre les mains. Mais quel animal ce Néron! Sous ses air patauds, il ne démontre jamais que des choses fondamentales! Dommage qu'il ne sache pas mieux les exposer."
("One of these days, you will have to explain to me what Néron's local symbols [are]. I understood nothing of what Lang said about them - and neither did I understand Néron's paper, which I once had a look at. What an animal Néron is! Underneath the clumsy airs, everything he proves is fundamental! It is a shame he doesn't know how to present his work better.")
Et cetera :)
An excellent question!
Best Answer
Heinrich Weber uses Einheit and e in his Lehrbuch der Algebra (1896).