It was "Through the Looking Glass", you ninny, not Alice in Wonderland". And in any case, there's an earlier reference to him in the book of nursery rhymes "Gammer Gurton's Garland" in 1810, although the actual familiar nursery rhyme dates from the 18th century.
I can't back this up just yet but I'm sure it was during the Siege of Colchester during the English Civil War that the surrounded Royalists had a large mortar placed on the old Roman ramparts to shell the Parliamentarian encampment. This mortar became known as Humpty Dumpty and when it was finally dislodged by the attackers it tumbled down the hill and a nursery rhyme was born.