The escape of a diffusing particle from a potential well is an important aspect of many dynamic processes in chemistry, physics, and biology, and such an escape process often involves finding a restricted region or patch in a multidimensional potential well. We study an idealized model of this process via simulation and analytic theory. By combining results from special cases having either high symmetry or zero potential, we obtain a simple formula for the first-contact time for a particle moving to a boundary patch in an arbitrary number of dimensions. We apply this formula in two, three, and six dimensions. The predicted dependences of the first-contact time on the well depth and patch size are compared to results from simulations, and close agreement is found. We extend the theory to calculate the first-contact time between two particles in separate harmonic potential wells. As an application of this extended theory, we calculate the first-contact time for two parallel semiflexible biopolymer filaments and compare these results to previous simulations.