HUGS!
It sounds like he is going into organ failure and that is heart has started to pack in; it is more likely that he has lost his nail because he was having an episode and not the other way round. Just be there for him and any companions; let them be with him if they are still together. Keep him cosy, warm and as quiet as you can, but not hot. If you have got snugglesafes, warm one up for half the maximum time; re-heat when it has gone cold or replace with another snugglesafe of the same warmth; make sure that he can wiggle off he feels to hot. There is only so much you can do at this stage.
Be strong for him, and make his passing easy on him. If you feel that he is in acute discomfort for longer than 15-30 minutes, please consider pts, otherwise just let him slip away in his usual surroundings. There is usually a phase just before the end when the body is breaking down and a piggy is thankfully mostly out of it already where oxygen deprivation can cause kicking and discomfort; it is often called 'running to the Rainbow Bridge'.