I had the same issue after upgrading to Mountain Lion. I called Apple and after having to go through the usual PRAM reset I got onto someone who had some useful suggestions. The problem appears to be fixed now - I've not seem the problem recur.
The solution was to remove the plists for the Dock, Finder and Desktop. I suspect the Dock plist was the most important, as it is definitely a Dock related issue. Presumably in the upgrade process the plist has been corrupted in some way.
The plists in question can be found in ~/Library/Preferences. A quick way to get to the Library folder in Finder is to hold down Option then select Go from the Finder menu - Library will be in the list.
Inside Library open Preferences and find com.apple.dock.plist - send this to the trash or drag to the desktop. The other two that the Apple guy got me to remove were com.apple.desktop.plist and com.apple.finder.plist.
Now log out and in again (or do killall Dock from a terminal) - the Dock will recreate the plist. The Dock arrangement will now be back to default - you will have to re-add any apps you had there.