Before the Titan Kronos and his sister/wife Rhea became rulers of the heavens, Ophion and Eurynome were so. But, how did that occur when Ouranos/Uranus was king? He was only dethroned when Kronos castrated him and replaced him.
The story of Ophion being the first ruler of heaven is part of the Orphic tradition. Orphism stories may not always be 100% compatible with the more well known stories of Hesiod's theogony. In any case, according to Apollonius of Rhodes the transition from Ophion and Eurynome to Cronus and Rhea happened "through strength of arm":
He sang how the earth, the heaven and the sea, once mingled together in one form, after deadly strife were separated each from other; and how the stars and the moon and the paths of the sun ever keep their fixed place in the sky; and how the mountains rose, and how the resounding rivers with their nymphs came into being and all creeping things. And he sang how first of all Ophion and Eurynome, daughter of Ocean, held the sway of snowy Olympus, and how through strength of arm one yielded his prerogative to Cronos and the other to Rhea, and how they fell into the waves of Ocean; but the other two meanwhile ruled over the blessed Titan-gods, while Zeus, still a child and with the thoughts of a child, dwelt in the Dictaean cave; and the earthborn Cyclopes had not yet armed him with the bolt, with thunder and lightning; for these things give renown to Zeus.