For how many years does a university keep the thesis?
As far as I am aware, most universities keep a record of PhD thesis awards (title and recipient) in perpetuity. It is also the responsibility of the university library to archive the thesis; which is usually done on a permanent basis.

The reason for this is that future researchers, when doing their literature search should be reading these thesis to understand prior knowledge, as each PhD should be an original contribution to the sum of knowledge. Technology has enabled most universities to eliminate some of the burden associated with the perpetual storage of the thesis documents by allowing the microfilming of the thesis, which has now become the scanning and electronic storage of the work. There are consortia of university libraries that are working to ensure the problem of permanent storage of electronic texts is addressed in an era where we have non archival quality of electronic media. 

The answer for the storage of PhD thesis and records would be "forever". For a Master's thesis or dissertation the answer is less clear. In many universities I am familiar with, often only the awarding department archives the Masters, and they are less reliable. I have seen with my own eyes archives of older Masters works being "tidied up". To me it was a travesty, but to others it was modernity.

A degree is not usually revoked on the discover of a "mistake" in a thesis. A degree might be revoked if it was discovered that nothing in a thesis was the original work of the student who submitted it; otherwise known as plagiarism, theft or deceit. It would depend on the statutes and regulations on the awarding institution on whether or how this might happen. One can consult the news archives to find many reported incidents of this happening. The revocation can even happen posthumously!