The interjection "holy moley" is reportedly an invention of the people behind the Captain Marvel comic books. You can see it on the cover of Captain Marvel #35 shown in a blog post at Comic Mix.
It's not clear, but the writers could have been inspired by Greek mythology, in which moly is an herb that was given to Odysseus by the god Hermes to ward off the spells of the sorceress Circe.
Because it was "Captain Marvel" who coined and popularized the phrase, the correct spelling is as it appears in the comic ("holy moley"), although some sources list "holy moly" as an alternative spelling.
I love knowing the origins of words and phrases. I'm a big geek for understanding the context as well as the usage/connotation. In lit class this week I realized that I had summarily and unconsciously rejected New Criticism as a means of looking at a text and that I always want to know the context and history of a work that I'm reading (assuming it isn't contemporary American where I just sort of guess). Aesthetics are nice enough, but there seems no point to me to sit and compare the aesthetics of Birth of a Nation to Avatar so why do it with books?