Trusting God's response to our prayers produces peace regardless of the outcome because we acknowledge and accept that He is in control and all things are according to His Will.
When He answers in conflict to our own desires or preferred timing...we have peace because we know our God and have complete reliance upon Him!
This peace that surpasses all understanding comes from knowing God in a very intimate way...getting into His Word... trusting in His Promises, His Faithfulness, His Immutability, His Perfect Love and His ultimate plan for our future.
The more we know Him, the more we trust Him...and this is perfect peace...
"Trust in the Lord with all your heart,
and do not lean on your own understanding.
In all your ways acknowledge him,
and he will make straight your paths." (Proverbs 3:5-6)
"Many are the plans in the mind of a man, but it is the purpose of the Lord that will stand." (Proverbs 19:21)
"Behold, God is my salvation;
I will trust, and will not be afraid;
for the Lord God is my strength and my song,
and he has become my salvation.” (Isaiah 12:2)
"...but the people who know their God shall stand firm and take action." (Daniel 11:32)
.
"And the peace of God, which surpasses all understanding, will guard your hearts and your minds in Christ Jesus." (Philippians 4:7)
"For the Scripture says, “Whoever believes on Him will not be put to shame.” (Romans 10:11)
"I have said these things to you, that in me you may have peace. In the world you will have tribulation. But take heart; I have overcome the world.” (John 16:33)