Whatever you do, be careful. It does sound like you have a loose wire or two, which means it's very possible for a hot wire to be exposed or become exposed when you start troubleshooting. If you're going to open the fixture mount to locate the problem, be 100% sure the circuit breaker or fuse is off first. Electric shock is not fun!