I am using the latest wordpress, and I found out about a bug where if I upload media from a specific page (in my case, a plugin page using the Media API), a permalink is created for it, in the same format as the page-permalink format. This causes the links to overlap, and if I create a page with the same name as the image, the permalinks conflict.
A patch for this was made almost 2 years ago, yet has not been included.
I went into my installation and patched it myself, and it worked. I suggest this will be included in a new version. :)