If you ever feel outgunned, you can always use the MASS RETREAT command from the TACTICS PANEL.
You'll lose any current mission progress, but you get to keep all the Rez, data, and levelups you've collected.
Ships are expensive, so don't try and fight a losing battle.
If you find yourself with no ships or Rez, fall back and harvest some Rez in a safe location.
You can always build a Short Bus hip for free.