How to restore wrongly edited + wrongly saved TextEdit file? Have an important text file, but I accidentally edited its content and accidentally closed it (auto saving it).

Now I have a text file containing gibberish.

How do I restore the previous version? 

I tried looking into 

Saved Application State

com.apple.TextEdit.savedState

~/Library/Containers/com.apple.TextEdit/Data/Library/Saved Application State/com.apple.TextEdit.savedState

but is there a way?
TextEdit (and other apps that use the autosave system) will automatically save snapshots of documents at various times (e.g. when they're opened but before they're changed). Reopen the document in TextEdit, then from the File menu choose Revert To. It'll have a submenu that might have a relevant snapshot listed that you can choose directly. If not, choose Browse All Versions. You'll get a Time-Machine-like history on the right side of the screen, and you can look for the latest good version, then when you find what you want click Restore.

See this OWC/MacSales article, this one at OS X Daily, and this Apple support guide for more details and options.