If you find yourself in space with a heavily damaged and inoperable module (say your engines) there is one thing that you can try before you Self Destruct.
On the right-hand panel in the "Functions" menu you will find the "Reboot/Repair" option (as below). This will turn all off your ship's systems (including shields) and module off and try to bring them back online, including any damaged modules at the cost of taking some health from healthy modules.
This should give you enough health to use the modules and get back to a nearby station. If you have it fitted then using an Auto Field-Maintenance Unit is another option.