We prove a nonsmooth implicit function theorem applicable to the zero set of the difference of convex functions. This theorem is explicit and global: it gives a formula representing this zero set as a difference of convex functions which holds throughout the entire domain of the original functions. As applications, we prove results on the stability of singularities of envelopes of semi-convex functions, and solutions to optimal transport problems under appropriate perturbations, along with global structure theorems on certain discontinuities arising in optimal transport maps for Ma-Trudinger-Wang costs. For targets whose components satisfy additional convexity, separation, multiplicity and affine independence assumptions we show these discontinuities occur on submanifolds of the appropriate codimension which are parameterized locally as differences of convex functions (DC, hence C 2 rectifiable), and -depending on the precise assumptions -C 1,α smooth. In this case the highest codimension submanifolds consists of isolated points, each uniquely identified by the (affinely independent) components of the target to which it is transported.