Welcome to TeX-SX.
First of all, I would suggest you to save your files before compiling, at least the first time. If you do not save the file intentionally, TeXstudio will compile it as a temporary file, as you can check at the imagem. The name will be "texstudio_something".
These files are stored at the
Which you can access through any folder by typing
%appdata% at the path bar.
If you have saved your file, then you may just compile it without any worries like the one you had, because TeXstudio will then save it on the previous file.
I'm assuming your problem is not that a already saved file has been overwritten after a compilation. After all crashes and erros I have had, I do not remember any loss of data in a saved file.
You can find some more advice at TexStudio Autosave Recovery Question.