In this paper, we prove a new kind of modularity lifting theorem for p-adic Galois representations. Previous generalizations of the work of Wiles and Taylor--Wiles have (essentially) been restricted to circumstances where the automorphic forms in question have regular weight and arise from the middle degree cohomology of Shimura varieties. We show how one can overcome this restriction in certain cases. We give two applications. Firstly, we identify a certain unramified deformation ring R with a Hecke algebra T acting on a space of (Katz) weight one modular forms. In particular, the equality R = T holds even when T (equivalently, R) is not torsion free. Secondly, we prove an R = T theorem for ordinary two-dimensional regular representations over an imaginary quadratic field (of the type associated to elliptic curves), contingent on the existence of Galois representations associated to certain torsion classes. In the process of proving our main result, we also completely solved the problem (for p odd) of determining the multiplicity of an irreducible modular representation rhobar in the Jacobian J_1(N), where N is the minimal level such that rhobar arises in weight two.