It is worth making a save at the top of the Labyrinth before attempting Fima's rescue. Fima can be killed by a stray bullet, or he may be executed by his captors if they think he is going to escape. Either way, the only way to successfully complete the mission is to reload and try again. If possible try to kill the guards while they are away from the door to his cell to keep him safe while the bullets are flying.
If you have no success at keeping Fima alive, there is no way to respawn him, but you can try resurrecting him. Make a quicksave, target him so you get the SEARCH prompt, then type [ESC] and then [R]. If your game crashes, quickload and try again. Fima may return to life hostile to you (he has just been shot, after all) - in which case there isn't much you can do. Unfortunately the [ESC]+[F] 'Attitude' menu doesn't seem to work here.
If Fima is dead (or alive-but-hostile) you can leave him and complete your exploration of the Labyrinth. Then use the [ESC]+[F2] teleport menu to "caveminers". This takes you back to the Miner's cave, where you can talk to the Miner and give him the code book. This ends the rescue mission. Fima (alive and no longer hostile) should then return to the Miner's cave. You can then talk to him and get his next mission.
Please note that you will only get Fima's transition from the Labyrinth back to the Caves if you are able to talk to him in the Labyrinth. Otherwise, until other exits appear later on, you will have to use the [ESC]+[F2] menu each time you want to leave the Labyrinth.