Anyone who commits a sin and is embarrassed of it, is forgiven for all his sins.
The Gemara learns this lesson from the words that the prophet Shmuel told King Shaul. This occurred on the eve of a major battle with the Pillishtim, and Shaul was deeply afraid. He desperately sought Heavenly counsel. When Hashem ignored his entreaties, he enlisted a forbidden medium to achieve communication with the spirit of the prophet Shmuel, who had recently died. The Gemara quotes a Passuk from the dialogue between Shmuel's spirit and Shaul, and learns this lesson from Shmuel's words.
Anyone who commits a sin and is embarrassed of it, is forgiven for all his sins. For it is stated: And Shmuel said to Shaul, "Why did you disturb me, to raise me up!" Shaul replied, "I am in great distress, and the Pillishtim are at war against me; Hashem has turned away from me and does not answer me anymore, neither through the hand of the prophet nor in dreams, so I called upon you to inform me what I should do". Now, Shaul did not mention the fact that he was not answered through the Urim VeTumim as well [i.e. this was a slip of parchment upon which the Ineffable Name of Hashem was written and which was inserted into the breastplate worn by the Kohen Gadol], and this is because he was embarrassed that he had massacred the residents of Nov, the city of Kohanim [i.e. he was embarrassed to complain that the Kohen's breastplate did not assist him when he had ordered the massacring of so many Kohanim when he wrongfully accused them an act of treason punishable by death]. And from where do we know that, after being embarrassed for this sin, Shaul was indeed actually forgiven by Heaven for all his sins? For it is stated: And Shmuel said to Shaul... "Tomorrow you and your children will be with me". And R' Yochanan said that the words 'with me' means in my enclosure in Gan Eden [i.e. since Shaul was destined to enter the enclosure in Gan Eden occupied by the great prophet Shmuel, all his sins must have been forgiven].
The commentaries ask that we can clearly deduce that Shul was actually not forgiven for all his sins, from the fact that after this incident we find the Jewish People being punished for Shaul's sins. It happened after Shaul's death (שמואל ב' כא א-ו) that there was a famine for three years. Dovid inquired of Hashem as to its cause, and Hashem responded that it was because Shaul had killed the Giveonites. The Sages explain that what had occurred was that the Giveonites were woodchoppers and water drawers for the inhabitants of the city of Nov, and when Shaul ordered the massacre of Nov, seven Giveonites were killed, and the rest were left without a livelihood. The prophet goes on to relate that Dovid asked the Giveonites how he could atone for this injustice so that the famine would end. The Giveonites replied that seven of Shaul's sons be given to them and they will hang them.
It is these tragic incidents, which were brought about as punishment for Shaul's sin, that seem to challenge the idea that the Gemara presented - that after feeling ashamed for his sin of massacring the Kohanim of the city of Nov, Shaul was forgiven for all his past sins - for the sin of killing the Giveonites should also have been forgiven along with any other sin of Shaul that was forgiven, and hence any ensuing punishment for that sin would be superfluous.
The Gemara in Yuma
The Gemara in Yuma (פה ע"ב) teaches us a lesson regarding the atonement for sins which a man has committed to his fellow man.
עבירות שבין אדם למקום יוה''כ מכפר, עבירות שבין אדם לחבירו אין יוה''כ מכפר עד שירצה את חבירו. - For sins between man and Hashem Yom Kippur atones, but for sins between man and his fellow, Yom Kippur does not atone until he appeases his fellow.
In view of this, we can understand that although Shaul was certainly forgiven for all his sins, as the prophet Shmuel had clearly indicated, nevertheless, that specific sin of killing the Giveonites was not forgiven. The reason for this is because the killing of the Giveonites was a sin between one man and another, and therefore even after achieving atonements for his other sins, Shaul was unable to be forgiven for the sin of killing the Giveonites so long as they did not forgive him. Hence, the sin still carried the severe punishments, until Dovid was able to appease them by handing over seven of Shaul's children, through which he obtained the Giveonites' forgiveness.
פרשת אמור אות י"ט זרע שמשון