The fairy-tale theme in this novel is most apparent in its depiction of a rags-to-riches situation with the character of Pip. Pip is born in humble, rural, working-class surroundings but then catapulted to life as a well-to-do gentleman in London on account of an unknown benefactor. This sudden social rise of a lowly, formerly-despised figure is common to many fairy tales. Also consider Miss Havisham, who appears witch-like, and Estella, the beautiful maiden; again, such characters are staples of fairy-tales.
Of course, Dickens also gives the whole fairy-tale theme an ironic twist, when Pip's wealth melts away; his fall is just as sudden as his rise. Also, unlike the usual fairytale hero, he does not get the beautiful girl, Estella - at least not in the original ending of the novel. Even the revised ending which Dickens came up with to placate readers who were dissatisfied with this less-than-romantic outcome, remains ambiguous.
Pip' fall from grace is seen to be mostly deserved, however. He does not develop his character sufficiently as he ought; he becomes materialistic and condescending towards his old friends, Joe and Biddy. He has to be punished for this. The working out of a moral is also generally to be found in fairytales: the good characters triumph, the wicked are punished. Pip is not good enough, so he has to be humbled once more. There is no conventional happy-ever-after ending for him, although he does learn his lesson, and is grateful for the chance he is given to start over. This sense of thankfulness, once the great crisis in his life is past, is evident when he returns to his old home:
...my heart was softened by my return, and such a change had come to pass, that I felt like one who was toiling home after distant travel, and whose wanderings had lasted many years. (chapter 58)