In Oedipus Rex by Sophocles, it is neither stupidity on the protagonist's part nor defect on the author's that causes Oedipus to take so long to admit guilt (by this, I assume you are speaking of his ability to learn that he both killed his father and wed his mother). Rather, the reason for this has to do with two separate prophecies—one told to Oedipus, the other to Jocasta. It is only once he possesses knowledge of both—as well as learning of his true parentage—that he is able to comprehend exactly who and what he is.
Oedipus is shown early on to be a dedicated and caring ruler. When he discovers that the previous king's murderer was never found, he takes it upon himself to uncover the truth for the sake of his people. Were he not so insistent upon finding this out, he might never have learned the truth about his past. However, after being told by the prophet Teiresias that he is the murderer, everything begins to unravel. While speaking with Jocasta, she reveals to him a prophecy told to her long ago:
JOCASTA: An oracle came once to Laius. I do not say
From Phoebus himself, but from his ministers
That his fate would be at his son's hand to die -
A child, who would be born from him and me.
Though he has not yet discovered the truth, learning of this prophecy makes him believe in the power of oracles. When he figures out that one of the men he killed just prior to arriving at Thebes was Laius, Oedipus realizes that Jocasta's prophecy came true, at least partially. Just as Jocasta did for him, he now reveals a prophecy told to him when he was younger:
OEDIPUS: A man at a banquet overdrunk with wine
Said in drink I was a false son to my father.
. . .
In secret from mother and father I set out
Toward Delphi. Phoebus sent me away ungraced
In what I came for, but other wretched things
Terrible and grievous, he revealed in answer;
That I must wed my mother and produce
An unendurable race for men to see,
That I should kill the father who begot me.
Though it becomes clear to the audience at this point that Oedipus is Laius and Jocasta's son and that he did, indeed, kill his true father, he has not yet reached the same conclusion. He has not yet put all the pieces together—mostly because he still believes Polybus is his father. After a messenger comes to tell him that Polybus has died, Oedipus is given a brief reprieve from the weight of his prophecy. However, he soon finds out that the man "overdrunk with wine" was telling the truth. Only once he has all this information does he realize Jocasta and Laius are his parents. Additionally, though unbeknownst to him at the time, by killing Laius in a chance encounter he ended up fulfilling the prophecy that said he would murder his father and wed his mother.
To recap, it was not stupidity or defect that caused Oedipus to take so long in learning the truth. Sophocles crafted the play in such a way that allowed the audience to put the pieces together before the characters. Because of this, it highlights the tragedy that befalls both Oedipus and Jocasta once they learn the truth.
Note: For this response, the above quotations come from Ten Greek Plays in Contemporary Translations, edited by L.R. Lind and published by the Houghton Mifflin Company.