For some reason, Finder doesn't reset the icon grid on the desktop when the Dock is moved to the side of the screen. A quick Google search on this issue revealed nothing more helpful than the suggestion to set the Dock to automatically hide. But there is an easy way to get the Finder to move the desktop icons out from under the Dock.
Click on the Desktop, select Show View Options from the View menu, and slide the Grid Spacing slider around. As soon as you do this, the grid will be reset to respect the position of the Dock, and will move your desktop icons out from underneath the Dock. You can then put the slider back into the same position you had it before, and close the View Options palette.

