OS X switches resolution without monitor KVM
This is in all probability down to the KVM providing a fake monitor signal to OS X whilst the monitor is not "connected" to the OS X box; providing the KVM model would confirm this.

Generally, KVM fall into three monitor modes, usually these are priced low to high:


No signal - where the non active connections receive no indication that a monitor is connected
Fake - where the KVM provides a signal to the host that indicates a monitor is connected
Pass through - where the KVM emulates or attempts to provide through another fashion, the signal of the monitor to all hosts


EDIT: I did test adding a monitor to a Mac Mini and the resolution it first went in on was low, even after setting up the resolution, disconnecting the monitor (power off at the wall and back on) only sometimes caused the resolution to default back to a very basic one.