everything you describe point to a problem with your jquery, as you already suspected.
jquery is accessing the websites DOM. if the DOM is not finished with loading, jquery will fail. this is why is sometimes workes. it means that sometimes the DOM is loaded in time, sometimes it takes split seconds longer and jquery wont find anything.
solution is: make sure jquery is executed after the DOM is loaded.