While there exist few applications or SIM readers that can help retrieve deleted SMS messages from your SIM there isn’t any such application for iPhone, since it is storing the messages in phone memory.

There is just one option of retrieving the deleted messages from iphone which is available only if you have backed up or synched iPhone using itunes.

Data from iphone is backed up in your computer but that is not in a simple readable text file, usual path where the iPhone backup is stored in folder C:\Documents and Settings\yourusername\Application Data\Apple Computer\MobileSync\Backup\ i.e. for Windows XP

You will need to search all the files present in this folder and sub-folders for text ‘newest_message’
Download and install Notepad++ for free (or use Ultra Edit in case you have it) and use it advanced search in files menu for searching the files at the given path

It will return you with couple of files, open them up using Notepad ++ and there in between, what will appear to be lot of junk characters, you will find parts of your deleted text messages.