Storing widgets is complex topic. Basically it is such a multi-level-array-mess on the inside that very few people try to make sense of it (and even fewer succeed). :)
As far as I understand it myself while we can manipulate cute sidebar names on the surface, deep inside it is getting deconstructed to numerical IDs. So when you switch between themes amount and order of available IDs shift and widgets go haywire.
In theory any widget that can't find its designated place is supposed to land in "Inactive Widgets" area. In practice - who knows. I experienced widgets disappearing, appearing, duplicating and whatever.
So if you have any kind of complex widget setup I highly recommend not to experiment with themes on it. I have stockpiled idea to do reliable widget import/export, but it will take me plenty more time to gather enough courage to touch that. Did I say it is a mess inside? :)