It is narrated from Muhammad bin Zayd that Sayyiduna Umar (may Allah be pleased with him) gave judgement concerning a slave-girl whose master went out on a military expedition and instructed a man to sell her. Then her master freed her and had that witnessed, while she had already been sold. They calculated, and found that her freeing had taken place before her sale. So Sayyiduna Umar (may Allah be pleased with him) ruled that her freedom be upheld, that her price be returned, and that her dowry (mahr) be taken, since intercourse had been had with her.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الوكالة / 11445