We have developed the first gas-grain chemical model for oxygen fractionation (also including sulphur fractionation) in dense molecular clouds, demonstrating that gas-phase chemistry generates variable oxygen fractionation levels, with a particularly strong effect for NO, SO, O2, and SO2. This large effect is due to the efficiency of the neutral 18O + NO, 18O + SO, and 18O + O2 exchange reactions. The modeling results were compared to new and existing observed isotopic ratios in a selection of cold cores. The good agreement between model and observations requires that the gas-phase abundance of neutral oxygen atoms is large in the observed regions. The S16O/S18O ratio is predicted to vary substantially over time showing that it can be used as a sensitive chemical proxy for matter evolution in dense molecular clouds.