I don't know if we can overemphasize the value of contrition in the eyes of God. Psalm 34:18 says, "The LORD is nigh unto them that are of a broken heart; and saves such as be of a contrite spirit." And, that obviously included Ahab. Even Ahab received mercy from God when he humbled himself in repentance. But, let's not get ahead of ourselves.
Among his many faults, Ahab had a problem with covetousness. More simply, he coveted his neighbor's vineyard. Wanting it and being willing to buy it may have been harmless enough (I Kings 21:2), but when his neighbor Naboth refused to sell it, the wicked heart of Ahab was revealed. He couldn't take "no" for an answer. And, if Ahab's sinful heart was manifested, how much more was his evil wife's debauchery revealed? She had Naboth killed so that Ahab could have the vineyard which he desired.
Now, while Ahab was walking through his newly acquired vineyard, God sent Elijah to preach a sermon of rebuke and condemnation to him. The most amazing thing here is the quick swing of Ahab's attitude from a smug and victorious villain calling Elijah his enemy to a remorseful penitent in sackcloth. Did it work? Yes, this man who had allowed his evil wife to instigate unprecedented sin in Israel was shown mercy from the Almighty. Why? Because of his sincere fear and repentance (I Kings 21:29).