Theta loci and deformation theory