The dynastic history of Thebes in Greek mythology is crowded with a bewildering number of kings between the city's new foundation (by Cadmus) and the Trojan War (see Ogyges). This suggests several competing traditions, which mythographers were forced to reconcile.
Overview
The first kings of the Boeotia region (before Cadmus and the flood of Deucalion) were Calydnus and Ogyges (Ogygos). The first king of the settlement that would become Thebes was Cadmus, after whom the city was originally called Cadmeia. It only became known as Thebes during the reign of Amphion and Zethus, after the latter's wife Thebe.
When Cadmus died, his son Polydorus was still a minor and hence Pentheus, a son of Cadmus' daughter Agave and one of the Spartoi, became king. He met a tragic end after falling foul of the young god Dionysus.
Polydorus succeeded his nephew but only reigned for a short while. At his death, the kingdom was entrusted to his father-in-law, Nycteus, who acted as guardian for the young Labdacus, the son of Polydorus and Nycteis. During the regency of Nycteus, Thebes (Cadmea) made war against Epopeus, the king of Sicyon, who had abducted Nycteus' daughter, Antiope. (However, an alternate account says that Antiope fled Thebes to evade her father's wrath, and sought refuge with King Epopeus after finding herself pregnant by the god Zeus.) Nycteus and the Thebans were defeated, and Nycteus himself died of his battle wounds. He was succeeded as ruler of Thebes by his brother, Lycus.
Labdacus eventually became king. Another war erupted, this time over a boundary dispute between Thebes and Athens; once again, Thebes was defeated after King Pandion I of Athens received aid from the Thracian king Tereus. Labdacus himself survived the war. However, following in the footsteps of Pentheus, King Labdacus opposed the cult of Dionysus, and was killed by Dionysus' enraged devotees, the Maenads. Labdacus left behind a young son, Laius. Lycus again took control of Thebes, this time as a usurper, and denied Laius his birthright. This inaugurated a new dynasty. Lycus is said to have reigned for twenty years.
Lycus, as king and ruler of Thebes, waged war against Sicyon to avenge his brother and niece. This time, the result went in Thebes' favor, and King Epopeus was slain. However, Lycus and his wife Dirce proceeded to treat Antiope cruelly. Antiope was imprisoned, but she later contrived to escape, and was reunited with her twin sons, Amphion and Zethus.
Amphion and Zethus were the sons of Zeus by Antiope, conceived while Antiope was still in Thebes; they were born in secret and raised by shepherds in the vicinity of Mount Cithaeron. After their tearful reunion with their mother, Amphion and Zethus marched on Thebes and slew King Lycus and Dirce.
Lycus' death did not restore Laius to the throne. Amphion and Zethus seized power, ruling as joint kings of Thebes, and expelled Laius. Amphion's wife was Niobe, daughter of Tantalus, and they had seven sons and seven daughters together. Amphion and Zethus expanded the city (and renamed it Thebes) and built the seven gates of Thebes, naming them after Amphion's daughters (Thera, Cleodoxa, Astynome, Astycratia, Chias, Ogygia, Chloris). Niobe, a boastful woman, attracted the wrath of Artemis and her brother Apollo, who were furious at Niobe for taunting their mother. Artemis then decided to kill all of her daughters while Apollo killed all of her sons, thus all of her children were killed. Amphion committed suicide after the death of his beloved children. Zethus' son and only child had been killed earlier, and Zethus had died of a broken heart.
Thus, the throne of Thebes was vacant and the Thebans invited back Laius, who resided in the Peloponnesus under the protection of King Pelops, thereby restoring the original dynasty of Cadmus. When Laius became king, he married Jocasta, daughter of Menoeceus, son of Pentheus. Given that the Delphic oracle warned Laius not to have a son because that son was fated to kill his own father, Laius exposed his newborn son - who nevertheless survived, and grew up under the name of Oedipus. In a tragic tale - in which every step Oedipus took to avoid the oracle's predictions brought him closer to his fate - Oedipus killed King Laius and married Jocasta. Oedipus then became king of Thebes, as husband of the widowed Jocasta. The couple had four children, including two sons, Polynices and Eteocles.
When the seer Teiresias revealed Oedipus' horrible crimes - patricide, regicide and incest, no less - Oedipus was forced to abdicate. Jocasta killed herself, and Oedipus was shunned by his own children. Oedipus responded by cursing his sons Polynices and Eteocles.