The two cities of Troy and Thebes were the major focus of Greek epic poetry. The events surrounding the Trojan War were chronicled in the Epic Cycle, of which much remains, and those about Thebes in the Theban Cycle, which have been lost. The Theban Cycle recounted the sequence of tragedies that befell the house of Laius, of which the story of Oedipus is a part.
Homer's Odyssey (XI.271ff.) contains the earliest account of the Oedipus myth when Odysseus encounters Jocasta (named Epicaste) in the underworld. Homer briefly summarises the story of Oedipus, including the incest, patricide, and Jocasta's subsequent suicide. However, in the Homeric version, Oedipus remains King of Thebes after the revelation and neither blinds himself, nor is sent into exile. In particular, it is said that the gods made the matter of his paternity known, whilst in Oedipus the King, Oedipus very much discovers the truth himself.
In 467 BC, Sophocles's fellow tragedian Aeschylus won first prize at the City Dionysia with a trilogy about the House of Laius, comprising Laius, Oedipus and Seven against Thebes (the only play which survives). Since he did not write connected trilogies as Aeschylus did, Oedipus the King focuses on the titular character while hinting at the larger myth obliquely, which was already known to the audience in Athens at the time.