Dead reckoning navigation: gyromagnetic compass, how it is stabilized?
Gyromagnetic compasses do indeed exist even in smaller aircraft, and need not be overly complex. The basic principle for an analog system is as follows:

Heading is measured against a gyro rotating in the vertical plane (just like a normal heading indicator). The gyro may be in the instrument case, or electronically repeated from elsewhere in the aircraft.

The earth's magnetic field is sensed by a sensing unit, a "Flux valve" usually located in the wing, or otherwise in a good position to minimize electromagnetic interference from the aircraft.

The gyro position and the magnetic reference are compared electronically and the resulting difference becomes an error signal. This error signal is sent to electric motors on the gyro frame, which will move to very slowly (a few degrees per minute) correct the gyro to align with the magnetic reference, combining the short term accuracy of the gyro with the long term accuracy of the earth magnetic field. To further enhance accuracy, cut-out switches cuts the error signal out when the aircraft is banking/accelerating, as this tends to give a less precise magnetic signal from the flux valve, while a gyro is unaffected by it. See the Bendix King KCS55A for a real life example.

On older, larger aircraft, you'll find similar installations. On modern aircraft, with inertial navigation platforms (IRS) heading is often taken from the inertial platform as true heading, with magnetic variation applied from a database to provide magnetic heading. 

The IRU will in that case (among other things) act as a kind of gyrocompass, finding true north by leveling and rotating 3 nowadays usually mathematically modelled gyro planes (solid state Ring Laser Gyros, no moving parts), to align with true north, by sensing gravitation and angular movement around gyro axes from the rotation of the earth. The planes are then kept level by integrating gyro data, and filtering/fusing it with accelerometer data, movement over earth curvature, Schuler tuning, other sensor data etc.)