Suppose in mathematics, someone finds a completely new elementary proof of a famous theorem and wants his work ''peer reviewed'' on a site like MathOverflow or MathStackExchange before submitting to a formal journal. How safe would this be ?
If you post under your real name, I think that it is quite "safe" in the sense that your work is unlikely to get stolen because of this. In fact, posting your work on a public forum is the best defense I know against intellectual theft.
On the other hand, "Is this proof of a known result correct?" is generally not regarded as an appropriate MathOverflow question. There can be a fine line between asking questions that come up in one's research and asking others to vet your research. The former is the purpose of the site, whereas the latter is discouraged. Your question seems to fall on the wrong side. I think it would stay open, at least, on math.stackexchange.com.
If you have not already published work in the past, I might recommend that you try to get one-on-one help from a qualified (and trusted) mentor, rather than trying to crowd-vet your proof. It is not impossible to do research mathematics completely independently and with no academic affiliation -- I have seen people do so quite well -- but it is very rare and much harder than doing it with some assistance. It would be reasonable to seek help from the math department of any university near you. If the mathematicians you get in contact with can't help you, see if they can connect you to someone who can.
Postscript: I have observed on this site and others that amateur mathematicians often have significant concerns that their work will be stolen. I think these sentiments are very unfortunate, because they can serve to prevent these people from getting what would benefit them most: qualified help and supervision. I don't want to say that it is strictly impossible for someone's work to get stolen, but here are two things: (i) I have done mathematics for my entire adult life (more than 20 years), and I have never seen or heard of an amateur mathematician's work being stolen by a professional mathematician. Reports of theft of mathematical work of anyone by anyone have come to me...but very, very rarely. (ii) I would estimate that about 90% of the work done by amateur mathematicians is not publishable. This is not to say that most amateur mathematicians are hopeless or incapable of doing real, publishable work. However most professional mathematicians train for years and make use of enormous amounts of human capital in order to get to the point where they can do and write up publishable work. If they had been afraid of showing their work to their mentors, they would not have gotten anywhere in most cases. Just something to think about.
If you are an 'outsider' to the mathematical community and you have an argument which you believe provides a significant mathematical advance, you may well have broken new ground - but you should also seriously consider the possibility that your argument contains a mistake, and you should carefully think about your interactions with the mathematical community in that light.
I don't say this to discourage you, but I do want to impress upon you that you are part of a relatively large community of people who will look much like you to a mathematician - see for example the questions Handling unsolicited proofs of famous mathematical problems and I believe I have solved a famous open problem. How do I convince people in the field that I am not a crank? on this site, which give a good impression of the volume of similar requests your work is likely to be embedded in. Again, this is not to discourage you, but to encourage you to think carefully, and take your time over, how you engage with professional mathematicians you are asking to review your work. If nothing else, make sure you read and mull over all the answers on both threads.
That said, when you do communicate your findings to outsiders, you are justified in seeking protection for your work so it isn't later claimed by someone else as their own. I would generally advise you to take it easy on such protections: your main problem is overwhelmingly more likely to be getting mathematicians to take your manuscript seriously, not defending it from theft.
In that regard, the best defence I can think of is to make it publicly available, as widely as possible, under your real name. This can include posting your manuscript to the arXiv if you can post there, to viXra as an alternative, or to sites like MathOverflow or Math Stack Exchange. For good measure, if you post on Stack Exchange, you might want to ensure that your post is archived on the Wayback Machine. It's important to note that even then, your work is not "safe" in that someone else could, in principle, take that work and submit it as their own to a journal.
However, this is academic misconduct of pretty much the highest order, and if that were to happen you should contact the journal editor and the dean of the author's institution with proof (like your MathOverflow post!) that you are the original author of the unattributed work. That is immediate grounds for an investigation which can result in retraction of the paper and severe academic sanctions against that author. If it ever comes to that.
It is also important to note that, regardless of whether your work is safe or not, it may or may not be appropriate to make such a request of MO or MSE. In particular, the threads Using Math Overflow to check whether or not a proof is correct, On discussion of published papers at MO, and Appropriate or not: “To what extent are the results in Paper X correct?” indicate that such a request would be considered off-topic at MathOverflow. To tie this in with my initial point, posting review requests in inappropriate venues is a good way to quickly exhaust the goodwill of the mathematical community and make it much harder for your work to receive appropriate vetting even if it deserves it.
So what should you do? I would start with this advice.
If you say you have found a completely new elementary proof of a famous theorem, you instantly put yourself into the 'nutcase' box until you can prove otherwise (or unless you have already proved otherwise). Posting on MathOverflow is a good step to additonally move into the 'nuisance' box as well. Even if you are right, you have not attached your name to the proof in any formal way, so someone could steal it. Probably the route that is most likely to win you acceptance within the mathematical community is to find someone at a university or similar who is willing to mentor you, and don't conclude your proof is correct until you can actually convince another mathematician it is correct. If it really is elementary then that shouldn't prove so difficult.