The Lord has never had anyone who was qualified working for Him. Peter wasn't qualified, and even at our best, neither are we. If we realize that we are nothing and have nothing, then we are prime candidates to be used by God.
Peter went on to become probably the best known of the twelve apostles. The Lord used him mightily. But He didn't want him, or us, to forget that it was Christ in Peter and not Peter himself who was great.
This also illustrates the extent of our Father's love and forgiveness. If God not only forgave Peter for his sin, but also reinstated and advanced him, then surely we have not pushed God's grace beyond its limit. Where sin abounds, grace abounds much more.
God doesn't see us as a failure - just a learner. God can redeem the worst "failure" and work it together for good (Romans 8:28). We need to think like God.