I think that this issue is something of what Jesus is covering in the parrable of the vinyard workers (Mat 20:1-16). Those hired right at the end recieve the same pay as those who have been working all day - similarly, those saved near death are not any less saved then those who have been believers and lived a 'good' life all their life. You do not need to worry about having enough works to be saved, because no amount of works are enough to be saved. Even at our best we are simply doing as we aught, being faithful servants, so we cannot earn bownie points that will negate our sins. Paul makes in clear several times that we are only justified by the atoning sacrifice of Jesus, which cleanses us of sin.
However, as you say, there are many bits of the NT that seem to be saying otherwise. I think that the answer to this is that whilst you can make a theoretical distinction between faith and works for the point of saying that we are not justified by any merit of our own works, but purely by our faith in Jesus and His death for us, in practice it is a false distinction - faith and works canot be separated. This is set out in James 2:14-26 (emphasis mine);
14What good is it, my brothers, if a man claims to have faith but has no deeds? Can such faith save him? 15Suppose a brother or sister is without clothes and daily food. 16If one of you says to him, "Go, I wish you well; keep warm and well fed," but does nothing about his physical needs, what good is it? 17In the same way, faith by itself, if it is not accompanied by action, is dead.
18But someone will say, You have faith; I have deeds.
Show me your faith without deeds, and I will show you my faith by what I do.
19You believe that there is one God. Good! Even the demons believe thatand shudder.
20You foolish man, do you want evidence that faith without deeds is useless? 21Was not our ancestor Abraham considered righteous for what he did when he offered his son Isaac on the altar? 22You see that his faith and his actions were working together, and his faith was made complete by what he did. 23And the scripture was fulfilled that says, "Abraham believed God, and it was credited to him as righteousness," and he was called God's friend. 24You see that a person is justified by what he does and not by faith alone.
25In the same way, was not even Rahab the prostitute considered righteous for what she did when she gave lodging to the spies and sent them off in a different direction? 26As the body without the spirit is dead, so faith without deeds is dead.
So, a person who repents on their deathbead need not worry about not having time to do works; it is their faith that justifies them. But given time, a true faith will inevitably show itself by works. A so called 'faith' that has no works is clearly no true faith, a dead faith.
Hope that this helps,
God bless,
YN.