Found this on a google search so no guarantee it works:
Switch to the Finder application and choose "Find" from the File menu. Click on "This Mac" in the Search bar, then select "Kind" is "Document." Choose "As list" from the View menu. Then choose "Arrange by last modified" from the View menu. This will show you all of the documents that have been saved to your hard drive in newest-to-oldest order. Scroll down in the window and review these file names to see if there are any documents with names including "temporary" or "untitled," and with kinds that are word processing documents or plain text files. There will be many documents here, so use the date and time on each file to help narrow your search.
Drag these documents to the Pages icon in your Dock. They will open in Pages if they are saved word processing documents, and you may be able to retrieve the text of your lost document from these files. If a file cannot be opened in Pages, try dragging it to the TextEdit icon in your Dock instead.
Peter