About twenty years ago I had a Debonair with a compass which suddenly 'went loopy'.

Took a long time to track the source (yep eventually used a cheap boy scout compass), it turned out to be our tacho cable had 'gone magnetic'.

Removed the compass from harms way, pulled the tacho (no problems detected with it), and got the local TV repair man out with his de-gaussing coil. He activated it in the tacho hole beside the cable and circled it continuously as he withdrew to a few feet away. Repeated this twice more, then went and circled the main instrument panel once, said "try that". No more problems. Did it need the main panel circled?, he said not but did it to placate the LAME (A&P to you yankees).

All looked very 'black magic' to me, but it worked.

Track the source of the magnetism first, sometimes that can be just ONE hole in a bit of steel that was drilled too slowly. Yep, ever taken too long with a blunt drill bit and seen the chips attracted around the drill bit and site? One magnetic hole!