After Yosef is called out of prison and cleaned up for an appearance before the king, he seems to have learned his lesson and made amends. Yosef declares in front of Par'oh an important disclaimer, even before he listens to the dreams. He says that it is Hashem who will provide the answer and peace to Par'oh, not him.
Not only will he now only rely on Hashem and not on man, he now also attributes his success to God. After analyzing the text a bit, I realized that there is a clear difference from when Yosef spoke in jail to when he spoke before Par'oh. When Yosef interpreted the dreams of the wine steward and of the baker, he never mentioned that the interpretations come from God and not him. When he interpreted the dreams for Par'oh he clearly placed God at the forefront and gave Him all the credit.
Clearly Yosef spent his time in jail reflecting on his position.
Picture this: Yosef interprets the dreams of the wine guy and the baker, and shortly after the interpretations come true exactly as he had said. He is sitting in jail wondering when he will get out, as the wine guy is supposed to put in a good word for him to Par'oh. Eventually he realizes that he never should have relied on the wine guy, but should only rely on Hashem. The next time he gets his chance, he makes good on it.
Sometimes we daven to hashem asking for His divine intervention for our good in some way (be it winning the lotto, getting a certain job, or a shidduch or health, or whatever). When we get what we want (a.k.a our prayers are anwered positively), how long does it take us to realize it was God who provided it for us? When we go collect the lotto prize do we say right away thank you to Hashem who listened to our tefilos and provided? When we get the job do we say thank you to Hashem who made the boss like what he saw in you, or do you right away think, "Whew, I presented myself well and got that job! Let's celebrate!"
If you take the time to reflect on it, you will see that you daven to Hashem as a reflex, because you have already prepared as much as you can and you have nothing left to do, so you pray. When you get what you want, you do not associate your success with God, rather with your own efforts. This could be why we do not always get what we want (assuming it is really good for us and Hashem has reason to give it to us). This clear lack of bitachon in Hashem as the ultimate provider could negate the prayer we offered.
Yosef learned his lesson, will we learn ours?