I admit that I like Nagoyankeeさん's answer much more
I had been trying to understand the difference for a long time and couldn't figure it out. The only thing I knew for sure was that こと cannot be used after the verb いる, but in that case you have to use の.
The way my grammar book expalins it is kinda messy...
"ことand の differ in that こと generally refers to the abstract idea of factual knowledge, whereas の concerns the working of one's feelings."
And then provides 2 exemples that should have a different meaning, I just can't see why LOL.
この映画を見たことを忘れていました I had forgotten I had seen this movie.
この映画を見たのを忘れました I forgot to watch that movie.
LOL good luck with the understanding of this one. As I said I like much more Nagoyankeeさん "grammar" much more