This is a 100% software issue.
I had all of these problems for about a month (my previous post is in this topic on page 23).
Yesterday I finally installed iOS 5.1 beta 3, and everything's been working perfectly since then. For the entire day -- not a single loss of the network or "invalid SIM" message. I tested it everywhere, including the subway, and it maintainted signal very well all the time.
The phone also started picking up network very fast after the airlane mode. Before the update it usually went like "Searching", then "No service", and after 1-2 minutes finally it would catch the network. Now it's instantaneous.
My guess is that Apple is holding up the 5.1 release because of some glitches with Siri, e.g. she started failing to dial phone numbers from my address book, but at the same time she answers some questions and performs some task.
On the whole beta 3 is a solid build, and my phone is finally back!