Is it illegal to fly a Cessna 172S under day VFR with an inoperative vacuum gauge?
Your reading is correct: a Cessna 172 with an inoperative vacuum gauge is not airworthy.
Type Certificate Data Sheet No. 3A12, Revision 85 shows how Cessna 172 models meet FAA airworthiness requirements. Section XII, “Model 172S, Skyhawk SP, 4 PCLM (Normal Category), 2 PCLM (Utility Category), Approved May 1, 1998,” contains

Equipment
The basic required equipment as prescribed in the applicable airworthiness regulations (see Certification Basis) must be installed in the airplane for certification …
NOTE 2: Pilot’s Operating Handbook and FAA Approved Airplane Flight Manual (POH/AFM):  part number 172SPHUS-00 (or later approved revision) is applicable to the Model 172S. The airplane must be operated according to the appropriate POH/AFM …

The Comprehensive Equipment List in Section 6 of the POH/AFM gives the Combination Vacuum Ga[u]ge/Ammeter the R suffix, meaning required.
FAR 91.213(d)(2)(ii) reads

(d) Except for operations conducted in accordance with paragraph (a) or (c) of this section, a person may takeoff an aircraft in operations conducted under this part with inoperative instruments and equipment without an approved Minimum Equipment List provided -
  (2) The inoperative instruments and equipment are not -
    (ii) Indicated as required on the aircraft's equipment list, or on the Kinds of Operations Equipment List for the kind of flight operation being conducted;

But the equipment list does indicate the gauge as required, so this exception does not apply.
To fly the airplane to a repair station to fix the vacuum gauge, apply for a Special Flight Permit (or “Ferry Permit”) with your geographic region’s Flight Standards Office, as provided in FAR 21.197.