Petrophysical interpretation of well logs acquired in organic shales and carbonates is challenging because of the presence of thin beds and spatially complex lithology; conventional interpretation techniques often fail in such cases. Recently introduced methods for thin-bed interpretation enable corrections for shoulder-bed effects on well logs but remain sensitive to incorrectly picked bed boundaries. We introduce a new inversion-based method to detect bed boundaries and to estimate petrophysical and compositional properties of multilayer formations from conventional well logs in the presence of thin beds, complex lithology/fluids, and kerogen. Bed boundaries and bed properties are updated in two serial inversion loops. Numerical simulation of well logs within both inversion loops explicitly takes into account differences in the volume of investigation of all well logs involved in the estimation, thereby enabling corrections for shoulder-bed effects. The successful application of the new interpretation method is documented with synthetic cases and field data acquired in thinly bedded carbonates and in the Haynesville shale-gas formation. Estimates of petrophysical/compositional properties obtained with the new interpretation method were compared to those obtained with (1) nonlinear inversion of well logs with inaccurate bed boundaries, (2) depth-by-depth inversion of well logs, and (3) core/x-ray diffraction measurements. Results indicated that the new method improves the estimation of porosity of thin beds by more than 200% in the carbonate field example and by more than 40% in the shale-gas example, compared to depth-by-depth interpretation results obtained with commercial software. This improvement in the assessment of petrophysical/compositional properties reduces uncertainty in hydrocarbon reserves and aids in the selection of hydraulic fracture locations in organic shale.