Yeah it has happened to me before - hate it.
I was unsure like you, so I uploaded the melody on Soundcloud, and posted it on forums asking what the name of the song was.
One of a producer's biggest fears that is. It happened to me once when I was 15. Turns out the melody was from a song I've never even seen or heard of...
Accidental plagiarism, analogous to: "unknowingly murdering a person you've never seen or heard of, then finding out later on that somebody died."