Hi David,
Yes it is vital that both the gauge and the sender are earthed. I reckon that about 90% of electrical problems come down to poor earthing. Sometimes an apparent connection to earth does not get back to the battery due to muck, paint etc. or being connected to a part that is not earthed e.g. the tank unless a special effort has been made to earth the body of the tank.
Particularly a problem on 6V systems.
Glad you got yours working.