Have you lost an important document? Did your Mac crash while you have a document open? Don't worry: most software tools are able to recover documents automatically if this occurs.
If you've trashed a file and then realised you need it, you can recover it if you haven't emptied the Trash since you dragged the file there; just click the Trash icon in the Dock, and drag the file from the Trash folder to the Desktop.
If you've emptied the trash and are using Time Machine to make regular backups, open Time Machine, use the arrows at the bottom-right of the screen to 'go back' to a point when you know you had the file. Click on the file and hit Restore.
For other back-up software, refer to that app's manual to find out how to recover a file. Not running regular back-ups? Set up a regular schedule now. At least two: both on and off-site.
It's not time to panic yet. Trashed files aren't deleted from your disk, but their entry in the directory is removed and the space made available to be over-written. So as soon as you realise you need the trashed file, stop using your Mac for anything that's not necessary to recover the file.
There are a number of software tools that can help recover deleted files on your Mac. ProSoft's Data Rescue is one; Clever Files' Disk Drill another. Both apps have free demo versions that allow you to scan a drive for deleted files. Start a scan; if it 'finds' your trashed file, you might be in luck. Depending on the size of the file and the tool you use, you might be able to use the demo version to recover the deleted file.
If not, you'll have to pay for the full version. If neither tool can find your file, the next step is to take your Mac to a specialist data recovery firm. (This is expensive.) If the document hasn't been trashed but has been changed and you need an earlier version, OS X's versioning may be able to help.
The app you use to work on the document must support it, though. With the current version open, click on the File menu, then go to 'Revert to' and select 'Browse all versions'. Use the checkmarks on the right to navigate to the version you want, and click Restore. Or, hold down Option and hit 'Restore a Copy' to open the old version in a new document.