Scale refers to the proportions of a model to the real prototype. "O" scale refers to a 1:48 ratio between the size of the actual object and the model.
Gauge refers to the distance between the track rails. A reference to O gauge track, locomotives or rolling stock would indicate a distance between the track rails of 32mm to represent standard rail gauge 4'8.5".
Both O scale and O27 locos and cars run on O gauge track. However, the loco or car body and features of O27 are smaller in scale than their O "scale" counterparts. (There just doesn't seem to be any standard for O27 - its just smaller than O scale with O gauge wheels or tracks. The "amount" smaller is rather significant.)
From left to right: N, HO & O scale assembled signal tower kits by Atlas Model Railroad Co.
To represent the standard rail gauge of 4 feet 8.5 inches, n = 9mm, HO = 16.5mm and O = 32mm. It is in the models of narrow gauge prototypes that the deal gets a little more confusing. On30 , for instance, indicates 1:48 scale cars and locos running on 16.5mm (HO) gauge track.