Abu Mijlaz (may Allah have mercy on him) said that a man asked Sayyiduna Ibn Umar (may Allah be pleased with them both): I have stoned the Jamrah, but I do not remember whether I threw six pebbles or seven. He said: Go to that man, meaning Sayyiduna Ali (may Allah be pleased with him). So he went and asked him, and he said: If this happened to me in my prayer, I would repeat my prayer. He came back and told him (Sayyiduna Ibn Umar (may Allah be pleased with them both)), and he said: Abu al-Hasan has spoken the truth.
The Shaykh (may Allah have mercy on him) said: Perhaps, and Allah knows best, he meant repeating what is in doubt; likewise in stoning, the stoning about which there is doubt is to be repeated.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحج / 9668