How come ruptured ovarian cysts hurt?

Several reasons. But far-and-away the most common is that cyst rupture involves bleeding from the cyst; internal bleeding (in the peritoneal cavity) causes pain.