Carbonyl oxygen as nucleophile
The carbonyl oxygen can act as a nucleophile but it is strongly dependent on the conditions of the reaction.

Enolates can react as a nucleophile through either the $\alpha$-carbon or the oxygen.



(source)

The ratio of carbon to oxygen substituted products depends on the balance of orbital interactions and electrostatic interactions between the reactants. As you can see from the diagram above, the HOMO of the enolate has the greatest contribution from the $\alpha$-carbon and so reactions which are controlled by orbital energy factors take place through there. Conversely, the greatest negative charge is on the oxygen due to its greater electronegativity and so if the reaction is controlled by electrostatic factors then it will take place at the oxygen.

Changing the electrophile:
Alkylation is a common reaction of enolates and provides a good insight into the factors affecting the selectivity. If methyl iodide is used as the alkylating agent in a polar aprotic solvent then the reaction produces mostly the carbon alkylated product. Switching to methyl bromide or methyl chloride increases the amount of oxygen alkylated product and if methyl tosylate is used then the reaction produces mainly the oxygen alkylated product. This is because the increasing electronegativity of the substituent increases the positive charge on the methyl carbon, meaning that electrostatic interactions are more important. Additionally, the $\ce{C-X}~\sigma^*$ orbital (the LUMO of the electrophile) will be lower in energy in methyl iodide than in methyl tosylate due to the poorer energy match between the $\ce{C}$ and $\ce{I}$ atomic orbitals compared to $\ce{C}$ and $\ce{O}$. This brings the electrophile LUMO closer in orbital to the enolate HOMO, making the orbital interactions more important.

This thinking can be extended to other electrophiles. Many hard Lewis acids such as $\ce{R2BCl}$ and $\ce{(CH3)3SiCl}$ (credit to @Jan for pointing this out) will give almost exclusively oxygen substituted products. This is because the central atoms are small and highly charged, and so have strong electrostatic interactions with the oxygen end of the enolate. This can be viewed as an application of 'hard soft acid base theory', where the silicon and boron based electrophiles are considered hard acids and the carbonyl oxygen is a hard base. By comparison, neutral carbon electrophiles are soft acids and so exhibit less affinity for the oxygen. 

Changing the solvent:
Changing the solvent is one of the easiest ways to influence the outcome of the reaction, particularly in the case of alkylation. In polar aprotic solvents, the metal cation is strongly solvated but the enolate is weakly solvated due to the lack of acidic hydrogens on the solvent to form hydrogen bonds. In polar protic solvents, the oxygen end of the enolate is strongly solvated by hydrogen bonding which hinders reaction at the oxygen, strongly favouring C-alkylation, even with an alkyl tosylate.

Some more reading can be found here, here, here and here.