You are correct—the first sentence is ungrammatical while the second is grammatical. The devil, as always, is in the details. Consider the description of the that-trace effect:
…the phenomenon that the complementizer (that) cannot be followed by a trace…
In the first example, the “that” follows the trace. The sentence, prior to wh-movement, would be the following:
Did you think that she would win?
Therefore, the trace is at the position of the original “she,” which comes directly after the complementizer. Contrast this with the same transformation applied to the second sentence:
He that knows him doesn't love him?
In this example, the “he” precedes the “that,” so the that-t effect does not apply.