I am looking for an idiom that expresses the instance of a person being kind to someone who doesn't deserve it.
The biblical term used for this is to heap coals of fire on his head. Below is the scriptural reference and a commentators explanation of it:
Barnes' Notes on the Bible Therefore, if thine enemy hunger ... - This verse is taken almost literally from Proverbs 25:21-22. Hunger and thirst here are put for want in general. If thine enemy is needy in any way, do him good, and supply his needs. This is, in spirit, the same as the command of the Lord Jesus Matthew 5:44, "Do good to them that hate you," etc. In so doing - It does not mean that we are to do this "for the sake" of heaping coals of fire on him, but that this will be the result.
Thou shalt heap ... - Coals of fire are doubtless emblematical of "pain." But the idea here is not that in so doing we shall call down divine vengeance on the man; but the apostle is speaking of the natural effect or result of showing him kindness. Burning coals heaped on a man's head would be expressive of intense agony. So the apostle says that the "effect" of doing good to an enemy would be to produce pain. But the pain will result from shame, remorse of conscience, a conviction of the evil of his conduct, and an apprehension of divine displeasure that may lead to repentance. To do this, is not only perfectly right, but it is desirable. If a man can be brought to reflection and true repentance, it should be done.
If you are looking for an idiom in English that expresses the idea that someone is being unduly kind to someone who doesn't deserve such kindness, consider the phrase "spare the rod"—which means to refrain from punishing someone who (probably) deserves punishment. This expression is tightly bound up in a longer proverb "Spare the rod, spoil the child." The longer wording suggests that (at least in situations where a child is the transgressor) forbearing to punish is not a kindness at all, but a harmful kind of misplaced clemency. Christine Ammer, The American Heritage Dictionary of Idioms (1997) has this entry for the full expression:
spare the rod and spoil the child Discipline is necessary for good upbringing, as in She lets Richard get away with anything—spare the rod, you know. This adage appears in the Bible (Proverbs 13:24) and made its way into practically every proverb collection. It originally referred to corporal punishment. It is still quoted, often in shortened form, and to day does not necessarily mean physical discipline.
The formulation in Proverbs, as rendered in the King James Edition of the Bible is as follows:
He that spareth his rod hateth his son: But he that loveth him chasteneth him betimes.
That particular proverb is among the sayings in Proverbs that are attributed to Solomon. The expression "spare the rod" shows up in English texts going back at lest to John Flavel, Sacramental Meditations Upon Divers Select Places of Scripture (1690):
The Surety could not be spar'd, that the Principal might be spar'd for ever. If God had spared him [Jesus], he could not have spared us; if he afflicts his People, it is not for satisfaction to himself, but profit to us, Heb. 12.10. Should God spare the Rod of Affliction, it would not be for our advantage. So many sanctified Afflictions as are spar'd or abated, so many mercies and spiritual advantages are with-held from us. But as for those strokes of Justice that are the effects of God's Vindictive Wrath, they shall never be felt by Believers for ever. All the Wrath, all the Curse, all the Gall and Wormwood was squeez'd into Christ's Cup, and not one dropt left to imbitter ours.
Clearly, Flavel sees human beings as having approximately the same relation to God that misbehaving children have to their parents.
Turning the other cheek (emphasis added where the text connects to the OP's question, i.e., "expresses the instance of a person being kind to someone who doesn't deserve it"):
The phrase originates from the Sermon on the Mount in the New Testament. In the Gospel of Matthew, an alternative for "an eye for an eye" is given by Jesus:
38 Ye have heard that it hath been said, An eye for an eye, and a tooth for a tooth:
39 But I say unto you, That ye resist not evil: but whosoever shall smite thee on thy right cheek, turn to him the other also.
40 And if any man will sue thee at the law, and take away thy coat, let him have thy cloke also.
41 And whosoever shall compel thee to go a mile, go with him twain.
42 Give to him that asketh thee, and from him that would borrow of thee turn not thou away.
In Matthew 5:38–5:42 KJV In the Sermon on the Plain in the Gospel of Luke, as part of his command to "love your enemies", Jesus says:
27 But I say unto you which hear, Love your enemies, do good to them which hate you,
28 Bless them that curse you, and pray for them which despitefully use you.
29 And unto him that smiteth thee on the one cheek offer also the other; and him that taketh away thy cloke forbid not to take thy coat also.
30 Give to every man that asketh of thee; and of him that taketh away thy goods ask them not again.
31 And as ye would that men should do to you, do ye also to them likewise.
Luke 6:27–31 KJV This passage is variously interpreted as commanding nonresistance, Christian pacifism or nonviolence on the part of the victim.
To befriend, look after, or take care of someone who proves to be traitorous, untrustworthy, deceitful, or ungrateful.
I thought the profligate had seen the light and was seeking redemption, and so I took him into my care. But before long, I knew I had nursed a snake in my bosom, as I awoke one morning to find myself robbed blind!
The closest expression I can think of that captures an instance of this would simply be the word benevolence, which is not an idiom. The closest idiomatic phrase I can think of is, a random act of kindness. Act of kindness, might also do but it is not idiomatic.
The question seems to be asking for a noun, rather than an idiom. Idioms in general tend to present a value proposition with commonly used phrasing. So as the other comments demonstrate there many such idioms that express a value proposition related to the idea of showing undeserved kindness but all of them express a value proposition, related to the idea, not an instance of the act itself.