Someone I know copied a file into a directory over another one and hit "replace" accidentally. Is there any way to recover the older version of the file on Mac OS X Leopard 10.5.8?
Time Machine was not running at the time.
This is one of the scenarios that Time Machine is made for. Hope your friend had it running.
If so, then simply navigate to the directory where the file lived in Finder. Then select the Time Machine icon from your menu bar and choose "Enter Time Machine". The space-themed time machine interface will appear and you can travel back in time to before you (oops, your friend) replaced the file.
If there was no backup, then I'm afraid that file is gone. That's exactly why you should always be backing up.