Yup the vast majority of trailer light issues are directly linked to probelms with the ground. I used to fix trailers for guys when I was living in Victoria, the salt water really does a number on metal to metal connections.
Happy you had a eureka moment :)