How to fix missing Dock icon when Safari is active and minimized?
Minimising into the right hand side of the tray is pretty much the norm for so called "document based applications", whereby an open application may well have 1 or more windows (or "documents") open.  This allows each individual window to have it's own minimised icon, with a preview based icon to allow you to distinguish between them.

Applications which are not multiple window based, things like say Disk Utility etc, usually minimise to the application icon instead, and even if (like Safari) they do have multiple windows, then clicking the dock app icon should take you to the most recent window if it's not merely the only one.

Either way, your running applications icon for Safari should remain in the dock, although I have to admit that mine also went missing recently, although I can't recall if this was pre or post ML.

A reboot should fix it, as it seem to me to be a transient fault, but if you are familiar with Terminal.app you can type the following in to restart the Dock process, which should clear out any such gremlins:


  killall Dock


You can also force document based applications to only minimise to the dock icon and not produce per-window icons on the right hand side of the dock in System Preferences: