Generally speaking, you'll be fine using an ultrasonic cleaner if the plating is intact. You may also be fine using it on a razor where the plating isn't intact but there's an increased risk of the process removing further plating.
The thin gold plating on vintage Gillettes can be more susceptible to damage by ultrasonic cleaning though.