Producer swings to profit as oil rebounds