When can surgery on a null-homologous knot K in a rational homology sphere produce a nonseparating sphere? We use Heegaard Floer homology to give sufficient conditions for K to be unknotted. We also discuss some applications to homology cobordism, concordance, and Mazur manifolds.