Insectivorous birds living in polluted areas are not only exposed to pollutants but they may also be affected by changes in their invertebrate food. The populations of many invertebrate species are affected by environmental pollution and such changes may lead to differences in the diet of insectivorous birds. We examined nestling food quality (invertebrate composition and heavy metal levels) and breeding performance of two cavity-nesting passerines, the Great tit, Parus major, and the pied flycatcher, Ficedula hypoleuca, in an area with long-term heavy metal pollution by a copper smelter. There were no differences in feeding frequencies or the amount of food that parents provided to their nestlings between polluted and unpolluted sites, but food quality in a polluted area differed from that of the control area in both bird species. P. major took more beetles and variable "flying insects" and less caterpillars (of smaller size) and moths in the polluted area as compared to the unpolluted one. F. hypoleuca ate more beetles and larvae and less moths and spiders in the polluted area. Breeding success of P. major was better when the nestling diet contained a large proportion of caterpillars and the relationship was especially strong in the polluted area. On the contrary, F. hypoleuca broods succeeded equally well with variable diets. Our data suggest that a more opportunistic forager, F. hypoleuca, is less vulnerable to a changing invertebrate composition caused by human environmental impacts than a caterpillar specialist, P. major. In a heavy metal polluted area, F. hypoleuca seems to be more sensitive to a decreased amount of Ca rich food items (e.g. snails) while P. major suffers especially from the lack of carotenoid rich caterpillars. Our results emphasize the importance of secondary environmental changes, like food quality, in addition to direct impacts of pollutants.