those who(m) he thought were guilty
The second case is the simplest to analyse
b. those who he thought were guilty
Step 1 - those who (he thought) were guilty
Step 2 - those who were guilty (he thought)
Step 3 - those who were guilty, he thought (nominative)
a. those whom he thought were guilty
This supposes that "to think" is being used transitively. It seems doubtful in this case.
I can say "I think many thoughts" but what is the direct object in sentence (a)? Is it "whom", I don't believe so.
Some years back, it was idiomatic to say, "He thought John guilty", "He thought Mary shallow", "He thought them impertinent."
These were contractions of: "He thought John to be guilty", "He thought Mary to be shallow", "He thought them to be impertinent."
So think has traditionally been used in transitive form and so we could, according to this convention say:
those whom he thought to be guilty
The reason this is acceptable is that the infinitive cannot take a subject.
those who he thought were guilty
is a noun phrase consisting of a head noun -- in this case a demonstrative pronoun those, meaning those people by presupposition -- followed and modified by a restrictive ("integrated", in CGEL's terminology) relative clause who he thought were guilty.
The relative clause always contains its relative pronoun, but the relative pronoun is not always a constituent of the matrix relative clause. Normally it's the subject
- those who came to scoff
or the object
- those whom we scoffed at
or even the object of a pied-piped preposition
- those at whom we scoffed.
But not in this case. The relative clause here has two verbs:
- thought, past tense third person singular, subject he;
and
- were, past tense third person plural, subject who (identifying the antecedent those).
This means two tensed clauses, each with its own verb, but different subjects, one singular and one plural.
The relative pronoun who is extracted and moved (to the beginning of the relative clause, right after those) from the complement clause, where it is a subject. By the strict nominative rule for all subject pronouns, *whom should be excluded in this case. Yet CGEL says there is variation.
This is another way of saying that different people follow different rules where whom is concerned. As Pullum has pointed out graphically, for many English speakers the dead pronoun whom has ascended to the high-faluting pantheon of words that one throws into a sentence to make it more "formal". Or something.
1) He thought [that] they were guilty.
Here, we have a matrix clause and a content clause. The verb of the matrix clause is "thought". Its subject is "he" and its direct object is the content clause. The verb of the content clause is "were". It's subject is "they" and it's subject complement is "guilty". An optional "that" functions as a subordinator.
2) those who(m) he thought were guilty.
Here, we have a relative clause modifying "those". The words that remain the same between these two examples also retain their functions. The notable difference is that "who(m)" takes on the functions of both "that" and "they". Additionally, it relates the matrix clause which contains it to the pronoun "those".
Here who(m) is subject of the content clause functioning as complement of thought:
Where I said "direct object", this says "complement". Disregarding that, "who(m)" is the subject of "were", and "who(m) ... were guilty" is the argument of the verb "thought". That is to say, "who(m)" serves the same job in 2) that "they" serves in 1).
it is not subject of the relative clause itself but of a finite clause embedded within the relative clause.
What we're regarding as the relative clause is a matrix clause. It's the clause with the verb "thought". The subject of "thought" is "he", not "who(m)". "Who(m)" is a subject, but it's the subject of "were". In other words, "who(m)" is not the subject of the relative clause, but rather the subordinate content clause. That is, of course, an embedded finite clause.
In this construction there is variation between accusative whom and nominative who.
Some people use "who", some people use "whom". That's variation. 'Nuff said.
There is something that isn't said. Not one part of that CGEL passage claims that the relative pronoun is not a part of the relative clause. What is says is that it does not act on its own as a constituent of that clause.
Here's where you've gone astray: the relative clause is not simply "he thought". The clause "he thought" does not exist in this example at all. Those two words are the two words of the relative clause that are not also parts of the content clause.
The content clause is "who(m) ... were guilty".
The relative clause is "who(m) he thought were guilty".
The content clause is embedded within the relative clause.
The "who(m)" attaches the entire relative clause to the pronoun "those". It can't do that if it's buried behind the subject and verb of its matrix clause. If we bother to use it at all, we bring that word (or, as in the case of pied-piping, the smallest constituent containing it) to the front of the clause, which conveniently places it next to the word to which it relates.
As it is not the subject of the relative clause, it also happens to be optional:
those he thought were guilty
Expressing the relative clause as a contact clause, however, simply isn't relevant to the choice between "who" and "whom". Rather, it's relevant to avoiding the choice entirely.