As I had a hard time figuring this out, this hint may be of help to other coming into the same situation...
I had a number of kernel panics due to a bad RAM stick. By the time I figured this out, my iTunes library file was damaged; iTunes built me a new one. However, when I plugged in my iPhone, it lost all the applications from the App Store, along with their data.
Restoring the applications was easy, as the files were still in ~/Music » iTunes » Mobile Applications. One just has to drag them into the iTunes window, with Applications selected from the sidebar. On the next iPhone sync, iTunes copied them onto the iPhone
However, all the application settings and data were still missing. The up-to-date backup was of no help. One has to resort to an older backup from Time Machine or another backup system. The procedure is as follows:
Mac OS X Hints
http://hints.macworld.com/article.php?story=2009013112435184