Jordan has asked me in the comments to address the dating issues for the Gospel of Mary, and also to speak to the point that Pagel's raises regarding John's dependence on the Gospel of Thomas.
The Gospel of Mary is a distinctively Valentinian text. This has not been addressed by many commentators, but the fact is if you know the Valentinian traditions, it is evident that this gospel is part of that exegetical strand of early Christianity. It is particularly interested in the concept of "grace" that is granted when the Son of Man descends, and how humans are redeemed and ascend through the various realms in order to return to the upper aeons. It is heavily liturgical, and appears to me to contain a eucharist homily. I am going to be writing about this at some length in the paper I am preparing for the Talpiot conference and volume. At any rate, this means that the text cannot date before 130 CE - Valentinus himself did not begin teaching until about 120 CE. I would actually date the text in the mid-second century.
As for the dependence of the Gospel of John on the Gospel of Thomas, this is something that I have written about at length in The Voices of the Mystics. It was published a couple of years prior to Pagels' popular book Beyond Belief. Pagels actually reviewed Voices in a SBL session the year Voices was published.
What I argue is that the "faith" mysticism in the Gospel of John is responding to a form of vision and ascent mysticism that the Gospel of Thomas has preserved. I don't think that the Johannine author necessarily had a copy of the Gospel of Thomas. But he was aware of mystical traditions that are associated with the disciple Judas Thomas, and he disapproves of them. What John argues is that God has come to earth so that we don't have to journey to heaven to see him and be transformed as the mystics in Syria were claiming. Rather, after Jesus' death, God becomes accessible to us through the Paraclete, God's spirit which is sent in Jesus' absence. This spirit is attained through baptism and eucharist, and through it we experience God immediately and directly.
So I understand the traditions to be engaged in discourse, a discourse which becomes part of the Gospel of Thomas and the Gospel of John. Thomas is a text that comes to completion around 120. The Gospel of John has to be finished by 100 since the Valentinians are heavily engaged with it already in the early second century. My point is that it is not that one text is dependent on the other, but that both were coming into existence around the same time, and the traditions had been in conversation for some time before the composition of either text was complete. I think that we have to begin to become more nuanced in our discussions of dependence and texts, which is why I wrote chapter one of Recovering the Original Gospel of Thomas. I try to lay out a new methodology to get us beyond all the either/or categories that have stunted our past discussions. I recommend that chapter even if you are not interested in the Gospel of Thomas.