Therapies that target signalling molecules that are mutated in cancers can often have substantial short-term effects, but the emergence of resistant cancer cells is a major barrier to full cures. Resistance can result from secondary mutations, but in other cases there is no clear genetic cause, raising the possibility of non-genetic rare cell variability. Here we show that human melanoma cells can display profound transcriptional variability at the single-cell level that predicts which cells will ultimately resist drug treatment. This variability involves infrequent, semi-coordinated transcription of a number of resistance markers at high levels in a very small percentage of cells. The addition of drug then induces epigenetic reprogramming in these cells, converting the transient transcriptional state to a stably resistant state. This reprogramming begins with a loss of SOX10-mediated differentiation followed by activation of new signalling pathways, partially mediated by the activity of the transcription factors JUN and/or AP-1 and TEAD. Our work reveals the multistage nature of the acquisition of drug resistance and provides a framework for understanding resistance dynamics in single cells. We find that other cell types also exhibit sporadic expression of many of these same marker genes, suggesting the existence of a general program in which expression is displayed in rare subpopulations of cells.