It happens to me all the time. I’ll have this tune swimming around in my head. Sometimes I can’t think of the name of the song or perhaps even where I’ve heard it. Before my appendix ruptured in the summer of 2003 I kept whistling and humming a tune over and over. It took me a while to figure out it was the hymn “God Will Take Care of You.” It would have been nice to have had this handy little search at Musipedia. You can enter a contour, the pitches, the rhythm, or even try to sing or hum to search for a tune. I tried the contour search today, but the hymn didn’t pop up as there weren’t enough samples provided. I did get several good results for pop and classical tunes. Here is an example of one I did for “Michael ,Row the Bow A Shore.” The first note of the tune is represented as an asterisk. If the second note goes up, you type “U,” if it repeats the pitch type “R,” and if it goes down you of course type “D.” So my string of pitches looked like this:
The search results brought up several songs but listed “Michael, Row…” as the first choice. It’s a pretty good site, especially if you are haunted by tunes as much as I am!