TL;DR:
In one study I found, major depression preceded onset of BDD in 22% of cases (Gunstad & Phillips, 2003).
More Complete Answer
Reading Phillips & Stout (2006) linked in the answer by @Fizz, they state that (emphasis added)
Our findings additionally suggest that BDD is not simply a symptom of depression. If it were, BDD would be expected to remit around the time of depression remission and during subsequent months.
Also highlighted in Phillips & Stout (2006) was the fact that a double-blind cross-over study in BDD found that the SRI clomipramine reduced depressive symptoms more than the non-SRI antidepressant desipramine; this finding suggests that depression was secondary to BDD (Hollander et al., 1999).
In Phillips & Stout's study:
[D]uring the 3 months after remission of major depression, BDD persisted for most subjects, with fewer than 30% of subjects attaining full remission from BDD.
To add to this, Gunstad & Phillips (2003) had this to say:
[O]ur finding that major depression usually began after BDD may simply reflect the fact that major depressive disorder typically begins in the mid-20s, whereas BDD usually begins in the early to middle teenage years. An alternative explanation is that major depression may reflect depressive symptoms and demoralization as a secondary complication of BDD. Although it cannot be determined whether one disorder causes another, our clinical impression is that the major depression that so frequently co-occurs with BDD is often due to BDD; however, this does not always appear to be the case. Indeed, in this study major depression preceded onset of BDD in 22% of cases. It is also worth noting that onset of social phobia usually preceded onset of BDD, as would be expected based on social phobia’s usual age of onset. This suggests that in this study, “primary” social phobia was differentiated from the marked social anxiety typically caused by BDD, which would be expected to begin at the time of, or after, onset of BDD. It is sometimes difficult clinically to differentiate primary social phobia from social anxiety secondary to BDD.
References
Gunstad, J., & Phillips, K. A. (2003). Axis I Comorbidity in Body Dysmorphic Disorder. Comprehensive Psychiatry, 44(4), 270–276.
DOI: 10.1016/S0010-440X(03)00088-9 PCMID: PMC1613797
Free PDF: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1613797/pdf/nihms12699.pdf
Hollander, E., Allen, A., Kwon, J., Aronowitz, B., Schmeidler, J., Wong, C., & Simeon, D. (1999). Clomipramine vs desipramine crossover trial in body dysmorphic disorder: selective efficacy of a serotonin reuptake inhibitor in imagined ugliness. Archives of General Psychiatry, 56(11), 1033-1039.
DOI: 10.1001/archpsyc.56.11.1033 PMID: 10565503
Phillips, K. A., & Stout, R. L. (2006). Associations in the Longitudinal Course of Body Dysmorphic Disorder with Major Depression, Obsessive Compulsive Disorder, and Social Phobia. Journal of Psychiatric Research, 40(4), 360–369.
DOI: 10.1016/j.jpsychires.2005.10.001 PMCID: PMC2786172
Free PDF: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2786172/pdf/nihms92762.pdf