Several different pathways for the evolution of dioecy from hermaphroditism have been invoked and analyzed. These have largely considered either the spread of male- or female-sterility mutations in a monomorphic hermaphroditic population (i.e., the evolution of gynodioecy or androdioecy, respectively) or the gradual divergence in sex allocation of two classes of individuals, one that becomes increasingly male and the other that becomes increasingly female in functional gender (the paradioecy pathway). Here we assess the conditions under which male- or female-sterility mutations may invade and spread in a heterodichogamous population, that is, a dimorphic population composed of protandrous and protogynous individuals. Our model is formally applied to heterodichogamous populations, but the ideas we explore may also apply to the evolution of separate sexes in distylous species, where plants are either long- or short-styled. The model predicts that, under many circumstances, conditions for the evolution of gynodioecy and androdioecy in a heterodichogamous population are the same as those for their evolution from monomorphic populations. However, if one or the other of the two morphs are already somewhat specialized in their functional gender, as might occur if the quality or quantity of seed set is time dependent, the conditions for the invasion of males or females are relaxed. In particular, androdioecy can evolve more easily under such circumstances in heterodichogamous populations than in monomorphic hermaphroditic populations.