You might wanna change the title of your thread. What you've just described is certainly not the erasure of all factory data. It's more a deletion of your personal files, which is a completely different problem. Just to ensure the people with that specific expertise are the ones who try to help.
As for your contacts data. The news is not as good as I'd like it to be.
The fact that you've mentioned only backing up now is telling me that you have never made a previous backup of your contacts data. Am I right in assuming so?
if you haven't done so, then you have only one saving grace: remember when you setup your phone the very first time and linked it to your gmail account, well that account can hold more that just your emails.
Depending on what option you chose at setup, and when registering your contacts on your phone, chances are, you've synced them to your gmail (Google) account as well. If that is the case, you can always either login to a computer and access all the data from there, or just re-login on your phone with the same email address and allow it to synchronize.
If, however, you hadn't selected that option, then I am afraid your contacts are forever lost in the ether. Sad, but if that's the case, you'll just have to re-build it from the ground up, by enlisting the help of your friends to provide you with the contacts you both share that they still have the numbers to. Sorry.