  We study relations between stellar mass, star formation and gas-phase
metallicity in a sample of 177,071 unique emission line galaxies from the
SDSS-DR7, as well as in a sample of 43,767 star forming galaxies at z=0 from
the cosmological semi-analytic model L-GALAXIES. We demonstrate that
metallicity is dependent on star formation rate at fixed mass, but that the
trend is opposite for low and for high mass galaxies. Low-mass galaxies that
are actively forming stars are more metal-poor than quiescent low-mass
galaxies. High-mass galaxies, on the other hand, have lower gas-phase
metallicities if their star formation rates are small. Remarkably, the same
trends are found for our sample of model galaxies. We find that massive model
galaxies with low gas-phase metallicities have undergone a gas-rich merger in
the past, inducing a starburst which exhausted their cold gas reservoirs and
shut down star formation. This led to a gradual dilution in the gas-phase
metallicities of these systems via accretion of gas. These model galaxies have
lower-than-average gas-to-stellar mass ratios and higher-than-average central
black hole masses. We confirm that massive galaxies with low gas-phase
metallicities in our observational sample also have very massive black holes.
We propose that accretion may therefore play a significant role in regulating
the gas-phase metallicities of present-day massive galaxies.

Cosmology and Nongalactic Astrophysics