Is a magnetic compass required for an IFR flight?
A magnetic heading indicator is required, but not necessarily a wet compass, like this one:

Image Source: Wikipedia - Author: Chopper

Digital devices or combined devices are also possible:

Image Source: WikiPedia - Author: Mysid

The required equipment for VFR flights states, as already posted in this question:


  §91.205   Powered civil aircraft with standard category U.S. airworthiness certificates: Instrument and equipment requirements.
  
  (a) General. Except as provided in paragraphs (c)(3) and (e) of this section, no person may operate a powered civil aircraft with a standard category U.S. airworthiness certificate in any operation described in paragraphs (b) through (f) of this section unless that aircraft contains the instruments and equipment specified in those paragraphs (or FAA-approved equivalents) for that type of operation, and those instruments and items of equipment are in operable condition.
  
  (b) Visual-flight rules (day). For VFR flight during the day, the following instruments and equipment are required:
  
  ...
  
  (3) Magnetic direction indicator.
  
  ...


The text further states for IFR:


  (d) Instrument flight rules. For IFR flight, the following instruments and equipment are required:
  
  (1) Instruments and equipment specified in paragraph (b) of this section, and, for night flight, instruments and equipment specified in paragraph (c) of this section.
  
  ...