Ok. I found the solution. Don\’t know it will work for all but it worked for me at least.
What I did is, I traced the code from where the error was coming. I came to know that it was due to a missing record entry in customer_eav_attribute table. It might have happened when I was upgrading from 1.7 to 1.8.
The missing record was of \"firstname\" attribute. What I did is simply checked the attribute code for firstname in eav_attribute table and simply copied the missing record in customer_eav_attribute table from my other magento installation.
And it worked.
Hope this helps somebody.