Imaam Ibnul Qayyim (rahimahullaah) stated:
The slave does not embark upon what he has been forbidden except through two ways. Firstly: (either) harbouring evil thoughts about his Lord that if he were to obey Allaah and preferred Him, He (Glorified Be He) will not grant him what is better from the lawful (things).
Secondly: (or) he acknowledges (that Allaah will grant him something better than the forbidden thing he pursues) and that whoever leaves something for Allaah’s sake, He (Glorified Be He) will replace it with something better; but lusts overcomes his patience and desires (overcomes) his intellect. The first affair is due to weakness in knowledge and the second a weakness in intellect and insight.
[Source: Al-Fawaa’id’ page 78]