My personal rule is not to fly unless I can afford to lose a ship twice. It also helps that I usually stick to one area at a time, and I keep most of my old ships.
As soon as I can't afford to lose a ship twice, I jump in one of my cheaper ones and continue on. Does it take longer to progress with this method? Oh yeah. Have I ever been stuck in a situation similar to the OP's post? No, and hopefully I never will be. It's easy to make a mistake in this game that can cause you several hours, if not days, worth of progress. You forget to request docking, fly into the slot and get blown to bits. There's some miscommunication between some members of your trading convoy, and someone ends up plastered on the station wall as two of you try to fit through the slot. You're fighting an Anaconda and suddenly his buddies show up armed with missiles and your shield has more holes than a block of baby swiss... You can say 'You could avoid it if you did XYZ!' all you want, but unfortunately humans are flawed beings, and we make mistakes and bite off more than we can chew; and since this game isn't forgiving (which I will argue is one of its charms), you could quite easily end up back at square one with a sidey and a knot in your stomach.
That's why I'm so paranoid and I horde just about everything I buy. Sure, that rainy day may never come, but it's better to start off in square one with a fully upgraded Viper, Vulture, or Type 7 than a Sidewinder.