Why file links appear in the folder sidebar and how can I prevent this from happening? My question is related to Remove link to something that is not a folder in the Finder sidebar, but my problem is fundamentally different. 

I still have file links appearing in my folder sidebar. But I know how to remove those links, I just right-click and choose the option Remove from the sidebar. 

I actually have no idea how files end up appearing in there: I don't drag them, I don't do anything special. Actually, if I drag them, I get a nice Forbidden icon. So I don't get how they should even appear. 

So why do they appear there and how can I prevent this from happening?

I have Mountain Lion 10.8.2.
You might accidentally be pressing the shortcut commandT which means “Add to Sidebar” in the Finder but is used for many different things in many other applications. So if you think another application is frontmost where actually the Finder is you'd accidentally add the currently selected file to the sidebar. Happened to me a few times.