If you can get the problem to happen when the car is sitting still ticking over there is an easy way to check the earths.
Connect a jump lead to the negative battery terminal. Connect the other end to a bare metal part of the engine. If the fault disappears then you need to do as savage bulldogs suggested. Remember to clean the area the terminals contact as well as the terminals themselves.
Might be an idea to check the other terminals at the alternator and battery. I've seen plenty alternators and batteries replaced and connected back up to manky corroded terminals.