And the incident which led to this is in John 20:24-29, where Thomas encounters Jesus for the first time since the resurrection. The first time I had this explained to me, the explanation was that in verse 29 Jesus is comparing (and rebuking) Thomas- who needed to see before he believed- and the Ten- who didn't need to see Jesus before believing.
The first thing to note was that the level of proof Thomas wanted was quite high- not just to see Jesus, but to actually touch His wounds. And Jesus invites Thomas to do just that. There is no exasperated "Oh, Thomas. Just have faith", but a willingness to provide the evidence Thomas wants. This is the Jesus who tell us that if we seek we will find (Matthew 7:7), the God who tells us that if we seek Him with all our heart we will find Him (Jeremiah 29:13-14). Yet, being offered this level of proof, Thomas doesn't take it- he believes because he has seen.
The second thing to note is that straight after this, John enters commentary mode, and explains in verses 30 and 31 why he wrote this Gospel. Jesus has just declared that those who have not seen, yet believe, will be blessed. This is not Jesus saying that the best faith is the blind faith. John seems to take Jesus' words and make clear that, yes, Jesus is addressing the Eleven, but He is also addressing us. John seems to be effectively saying "Here are the reasons for believing in Jesus. This has been written so you may believe. This is the Jesus that millions will live and die for."
The third thing is to ask whether the Ten actually did believe without seeing. In Matthew 28:17 we have this interesting little bit, often overshadowed by concentrating on Jesus telling the disciples to spread the Gospel to the ends of the Earth while He will be with them to the end of the age. And that is the little bit that some still had doubts. So, among the Eleven, there must have been some for whom seeing still wasn't enough. Moreover, in Luke 24, the Apostles have the testimony of the ladies who visited the tomb (vv. 10-11 shows the Apostles thought it was "idle talk") and of those on the Emmaus Road (vv. 33-35), yet when Jesus appears to them, they believe He is a ghost.
So, we shouldn't condemn or mock Thomas, when other Apostles showed the same attitude as he did. And, while Peter has acknowledged that Jesus is the Messiah (Matthew 16:16)- and then immediatley demonstrates (v. 22) that he has a wrong assumption about what the Messiah will do- it is Thomas who first declares that Jesus is "My Lord and my God."