Have you dumped an important file you meant to keep? Did you change a file and then save it when you didn't intend to? Don't worry: there are techniques and software tools that are able to recover trashed or altered files if this occurs.
If you've trashed a file and then realized you need it, you can recover it if you haven't emptied the Trash. Just open the Trash folder and drag it out. If you've emptied the Trash and are using Time Machine to make regular backups, switch to the Finder, then open Time Machine, and use the arrows at the bottom-right of the screen to "go back" to a point when you know you had the file.
Locate the file, click on it, and hit Restore. For other backup software, refer to its manual to find out how to recover a file. Not running regular backups? Set up a regular schedule now. At least two: both on and off-site.
It isn't time to panic yet. Trashed files aren't deleted from your drive, but their entry in the directory is removed and the space made available to be overwritten. As soon as you realize you need the trashed file, stop using your Mac for anything that's not necessary to recover the file.
Help is at hand
There are a number of software tools that can help recover trashed files. ProSoft's Data Rescue is one; Clever Files' Disk Drill is another. Both apps have free demo versions that allow you to scan a drive for trashed files. If neither tool can find your file, the next step is to take your Mac to a specialized data recovery firm. (Warning: this may be expensive.)
If the document hasn't been trashed but has been changed and you need an earlier version, OS X's Versions feature 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 the Option key and hit "Restore a Copy" to open the old version in a new document.