I managed to get it back in by loosing the locking nut first so it was all the way down but still had the problem that when tuning it back up the tuning nut would loosen on its own and the string note would go back down.
So I wrapped the string round once and seems to have work. Do you think therefore that it is better to wrap the string round once before tuning up rather than just straight through the hole and relying on the locking nut to keep in place?