What is the source of the doubt and guilt that Pip feels--is it his conscience, his attitude towards Joe, or his love for Estella?
As an orphan who is not loved by even his own sister, Pip in Dickens's "Great Expectations" begins life with much insecurity and uncertainty. Initially, his world is only the forge and the marshes, so when he is exposed to another environment, with his tenuous hold on reality already, he is vulnerable to the opinions of others. Because Mrs. Joe and Uncle Pumblechook have elevated the wealthy to a level of superiority, Pip has easily been made to feel inferior as he is "common" when he goes to play at Satis House. Likewise, his youthful admiration of Joe is mitigated by comparison to Estella and the wealthy Miss Havisham.
So, since Pip begins to value wealth and social position, he rejects Joe and attaches unrealistic superiority to Estella, the "star" who appears delightful from afar. In short, Pip acquires false values which he later recognizes. For instance, after the embarrassment of Joe's visit to London, Pip hurries out to apologize to Joe but he is gone. He narrates,
All other swindlers upon earth are nothing to the self-swindlers, and with such pretenses did I cheat myself.
In another instance, when Magwitch arrives in London, Pip is initially repulsed as he learns that the old convict has been his benefactor. However, the good nature of his childhood returns and Pip tries to help the convict escape London; when Magwitch lies dying, Pip is solicitious:
I felt his hand tremble as it held mine....he need never know how his hopes of enriching me had perished.
In addition, Pip learns the concomitant lesson given to him by Mr. Jaggers:
Take nothing on its looks; take everything on evidence. There's no better rule.
Pip learns this lesson as he has learned all the valuable lessons of his life: from the example of Joe and from his conscience which Joe has helped to develop by teaching young Pip right from wrong. In Chapter 22 Herbert tells Pip one of his father's precepts:
It is a principle of his that no man who was not a true gentleman at heart was, since the world began, a true gentleman in manner. He says no varnish can hide the grain of the wood.
Ironically, then, Pip learns to become a true gentleman by returning to lessons learned at the forge where real values exist since there love and kindness abide. He also learns from the rough Mr. Jaggers not to take things on their appearances. It is, certainly, his conscience--"the grain of the wood"--that makes Pip doubt his false values, enabling him to become the better man, for in his guilt he comes home again, back to the values instilled on the forge.
It's a little bit of all of those elements. Pip's guilt certainly stems from his poor treatment of Joe when Joe visits him in London. Pip is snobbish and condescending towards Joe, who has been kinder to Pip than any other character in the book. Joe has no ulterior motive in raising Pip and maintaining his friendship with him. He simply cares for the young "gentleman." Because Pip is naturally a caring person, his conscience produces the guilt over his ill treatment of Joe.
Pip's main source of doubt is regarding Estella, especially when Drummle claims that he knows her and she proves it at the duel. At this point, Pip begins to realize that no matter how high he rises in society or how much he changes, his chance of marrying Estella or at least winning her love is doubtful at best.