Not sure how to prevent this from happening if we don't know the reason why this happened in the first place.
Are you running some kind of caching plugin? In the past such plugins have caused problems. Maybe clearing the cache solved the issue.
In any way keep an eye on it and when it happens again let us know via this thread.