Pip had always entertained the idea that his good fortune was from Miss Havisham and that therefore Estella was intended for him along with wealth: he thought he was being groomed to be Estella's husband. Since this is what Pip believed, he deemed it permissible to abandon Joe and Biddy to entrench himself in the sham life of a gentleman with the decadence and snobbery he mistakenly thought defined "gentleman." However, when he learned that his good fortune came not from Miss Havisham--who had no good designs for him at all beyond his being an occasional entertainment for herself and Estella--but from the terrifying and low and uncouth convict of the graveyard marshes, he felt utterly ashamed and utter despair--his "sharpest and deepest pain of all"--that he had rejected good and kind, though simple, Joe and goodhearted Biddy for--a convict. When his rejection of them was for a sham of high social life, it was justifiable; when pip found that the rejection was for an alliance with a convict, the reality of his own lowness came before him with clarity.
Miss Havisham's intentions towards me, all a mere dream; Estella not designed for me; I only suffered in Satis House as a convenience, a sting for the greedy relations, a model with a mechanical heart to practise on when no other practice was at hand; those were the first smarts I had. But, sharpest and deepest pain of all,—it was for the convict, guilty of I knew not what crimes, and liable to be taken out of those rooms where I sat thinking, and hanged at the Old Bailey door, that I had deserted Joe.