The best thing is to find a better ground for the HU if everything is running off it but the sub. If everything is running off an external amp, ground it to the negative battery terminal. That will pretty much eliminate any ground faults on that end. If it still does it, then you'll need to reroute your RCAs, becuase they are picking up interferance. Its odd that it happens when off though.
<span style='color:gray'><span style='font-family:Courier'>1995 e36 3 Series RIP
1999 e46 3 Series BURN IN HELL
2000 MR-S Roadster= Current</span></span>