I think what Solomon is trying to say by trusting an unreliable person in a difficult time is like a rotten tooth, or a faltering foot is that trusting the wrong person in a difficult situation can lead to pain or more consequences. What he means by a rotten tooth or a faltering foot is that The person can already be so damaged or broken or not have the right idea of the situation or the right state of mind. And it can cause way more damage and can lead nowhere but backwards.