I am very sorry to hear that. It's happened to me and I know how frustrating it feels.
The system was set to log people out after one hour of inactivity (understood as opening links, posting... not just having a window open and writing). Perhaps you were timed out? In any case, I have changed the settings of the forum to increase the time to logout. Nevertheless, I think that in cases where you have really spent a lot of time writing, take one second to select and copy the text before you hit the submit button, so if for one reason or another it doesn't process, you simply paste and submit again.
All the best,