“But if our unrighteousness demonstrates the righteousness of God, what shall we say? Is God unjust who inflicts wrath? (I speak as a man.)” (Romans 3:5).
Our unrighteousness provides an opportunity for God to demonstrate His righteousness, but that does not mean God should not inflict wrath on unrighteousness!
It is never the right thing to do the wrong thing, but it is right for God to use our times of unrighteousness to show what is right.