Where is "Contact" information stored within iOS4
I can't address the data corruption issue, but I can tell you where your PIM data is stored.

SSH into your phone and go to /private/var/mobile/Library/. There, you will find and AddressBook subfolder, along with SMS, Calendar, Notes, etc. The contents of these directories are the data that you need for each respective service.