A method includes spraying acid onto an inner wall of a wellbore formed in a subterranean zone with entrapped hydrocarbons that flow into the subterranean zone. Spraying the acid forms a subterranean cavern within a portion of the wellbore, the subterranean cavern being wider than the wellbore. The entrapped hydrocarbons flow into the subterranean cavern. The entrapped hydrocarbons include liquid hydrocarbons and water. The liquid hydrocarbons and the water separate under gravity within the subterranean cavern. The method also includes drawing the liquid hydrocarbons from the subterranean cavern to a surface of the wellbore.