States use repression to enforce obedience, but repression -especially if it is violent, massive, and indiscriminate -often incites opposition. Why does repression have such disparate effects? We address this question by studying the political legacy of Stalin's coercive agricultural policy and collective punishment campaign in Ukraine, which led to the death by starvation of over three million people in 1932-34. Using rich micro-level data on eight decades of local political behavior, we find that communities exposed to Stalin's "terror by hunger" behaved more loyally toward Moscow when the regime could credibly threaten retribution in response to opposition. In times when this threat of retribution abated, the famine-ridden communities showed more opposition to Moscow, both short and long-term. Thus, repression can both deter and inflame opposition, depending on the political opportunity structure in which post-repression behavior unfolds.