Welcome to Android Central! Which phone? Deleting a text thread shouldn't delete contacts that are saved to your Google Contacts (or your Phone account contacts). If there were people on the thread that weren't in your Contacts (so it was just their phone number listed), then you've lost those numbers. Sorry!
Is your contact stored in the thread?
I guess you haven't backed them up.
And if the deleted threads has not been overwritten by new files,recovery tool may help you.
If you have added some new files,the deleted thread can't be restored.