We extend homological perturbation theory to encompass algebraic structures governed by operads and cooperads. The main difficulty is to find a suitable notion of algebra homotopy that generalizes to algebras over operads O. To solve this problem, we introduce what we call thick maps of O-algebras and special thick maps that we call pseudo-derivations, which serve as appropriate generalizations of algebra homotopies for the purposes of homological perturbation theory. As an application, we derive explicit formulas for transferring Cobar(C)-algebra structures along contractions, where C is any connected cooperad in chain complexes. This specializes to transfer formulas for O-infinity algebras for any Koszul operad O, in particular for A-infinity, C-infinity, L-infinity and G-infinity algebras. A key feature is that our formulas are expressed in terms of the compact description of Cobar(C)-algebras as coderivation differentials on cofree C-coalgebras. Moreover, we get formulas not only for the transferred structure and a structure on the inclusion, but also for structures on the projection and the homotopy.