Currently when you buy a new ship you get almost the full value for the old one. Hence if you buy a sidewinder your cobra money should still be in the bank.
The only word of caution is you must sell all your equipment first. Otherwise you will not get any money for your weapons and upgrades. Sell these in the outfitting screen (sell your improved hull by buying the lightweight alloy one which is available almost everywhere). When you buy a new ship you always get a free loaned pulse laser.
The only difference between storing ships and this approach is the slight loss made on selling your upgrades and the pain of having to hunt round for a bit and find all your upgrades again.
