The correct sentence is:
Four pits have been unearthed, three of which contained gold.
'Of which' is correct because you need a possessive form to accurately describe the relationship between the three pits and the gold. Three of the pits contain gold, i.e., the gold is their 'possession' (in the grammatical sense).
Grammar.com, STANDS4 LLC, 2017. "“Whose” and “Of Which”." Accessed July 14, 2017. http://www.grammar.com/whose-and-of-which
Here is the first portion of the Grammar.com article:
When a possessive form is called for by the sentence, the word that
has to bow out and rely on which to borrow a preposition to show
possession. An example will show what I mean:
Congress passed the statute, the purpose of which was to lower taxes.
The words which and that have no possessive form. Here the of which is
showing the state of the statute possessing a purpose. We cannot say,
that’s purpose or which’s purpose. We have to use which, flip it over,
and connect it to statute by using the of which form. The word that
will not accommodate a preceding preposition.
I recommend reading the rest of the Grammar.com article (it is only three more very short paragraphs) for complete comprehension! ;-)
EDIT of 14 Jul 2017 @23:39 UTC
The following paragraphs were part of my original answer, but @Flater helped me see that these paragraphs were extraneous. I am leaving them here so interested readers can review the change from the correct but laborious answer to the pithy answer.
Extraneous Paragraphs Included in Original Answer
At first I found your question confusing, but I was not sure why. After thinking for a while about why 'this sentence sounds funny', I recognized the problem: "Four pits have been unearthed."
In common parlance, one does not need to 'unearth' a pit. By definition, earth (dirt, soil, rocks, etc.) has already been removed from a pit.
At least this is true when one uses 'pit' to mean "a natural or artificial hole or cavity in the ground."
I suspect you are using 'pit' in a less common--but perfectly valid--sense of the word, viz., a mine or a mine shaft.
Therefore, to avoid confusion, allow me to rephrase the sentence as follows.
The geologists have thoroughly explored and tested four quartz veins, three of which contain gold.
As ab2 succinctly explained in the comment section, 'of which' is correct for the sentence as you wrote it, i.e., with a comma.
'Of which' is correct because you need a possessive form to accurately describe the relationship between the three quartz veins and the gold. Three of the quartz veins contain gold, i.e., the gold is their 'possession' (in the grammatical sense).
If you wrote the sentence like the following example, the relationship between the geologists, the quartz veins, and the gold would be unclear.
The geologists have thoroughly explored and tested four quartz veins, three of them contain gold.
Do three of the geologists contain gold, perhaps in their teeth? Or do three of the quartz veins contain gold?
Yes, most readers would, after pausing to think about it, conclude that it's not three of the geologists who contain gold; it's three of the quartz veins that contain the gold.
However, effective prose does not force readers to pause, ponder, and parse meaning from a sentence. Effective prose enables readers to glide across well-crafted sentences, absorbing meaning effortlessly.
Thus, you want your reader to apprehend immediately that three of the quartz veins possess gold--and that's it.
i) "pit." American Heritage® Dictionary of the English Language, Fifth Edition. 2011. Houghton Mifflin Harcourt Publishing Company 14 Jul. 2017 http://www.thefreedictionary.com/pit
ii) California Gold Quartz Veins