I did what you suggested and worked like a charm. I lost anything that was not bought from iTunes. I heard there are third party programs to get it off you iPhone/ ipad etc lesson learned back up back up back up.
Glad I could help. There are indeed 3P apps out there to recover the contents of your iDevice as though it were an external hard drive, though since I'm not experienced with them I can't really speak to that. What I CAN recommend is you might want to consider iTunes Match. It's not free ($25/year) but it will extend the cloud download functionality to the rest of your music collection, for up to 5 computers and 10 iDevices at the same time. That way if you lose another Mac/PC in the future and you have no media library, you can sign in to Match and re-download ALL of it, not just purchased content. It also auto-upgrades some, but not all, iTMS files from the old DRM era to "iTunes Plus" DRM-free files.
Also, if you have Match and it matches up a CD you ripped or even some old album you got from P2P download, you can re-download Apple's master AAC file of the song to replace your copy. This process isn't 100% foolproof -- some folks have reported getting clean/nonclean copies of songs where their original was the other version. But it's really good most of the time, and has a great track record with reasonably common content. If your collection is thick with obscure indie titles, Match may not be as useful.
/disclosure: not an employee, not a stockholder, just a guy who has been there and done that who tries to help out fellow victims of lost-my-media-collection disasters. In my case it was due to my home being burglarized a couple years back.