What action should the pilot take when a TCAS RA (Resolution Advisory) provides opposite guidance to ATC instructions?
In the 2002 Überlingen mid-air collision, one crew followed the ATC instruction to descend instead of the TCAS Resolution Advisary to climb. This caused the deaths of 71 people.
Equipment and procedures have improved since then. Pilots should always follow TCAS Advisory and there is a FAA rule that deals with this. 91.123   Compliance with ATC clearances and instructions.

91.123   Compliance with ATC clearances and instructions.
-
(a) When an ATC clearance has been obtained, no pilot in command may
deviate from that clearance unless an amended clearance is obtained,
an emergency exists, or the deviation is in response to a traffic
alert and collision avoidance system resolution advisory. However,
except in Class A airspace, a pilot may cancel an IFR flight plan if
the operation is being conducted in VFR weather conditions. When a
pilot is uncertain of an ATC clearance, that pilot shall immediately
request clarification from ATC.
(b) Except in an emergency, no person may operate an aircraft contrary
to an ATC instruction in an area in which air traffic control is
exercised.
(c) Each pilot in command who, in an emergency, or in response to a traffic alert and collision avoidance system resolution advisory,
deviates from an ATC clearance or instruction shall notify ATC of that
deviation as soon as possible.
(d) Each pilot in command who (though not deviating from a rule of
this subpart) is given priority by ATC in an emergency, shall submit a
detailed report of that emergency within 48 hours to the manager of
that ATC facility, if requested by ATC.
(e) Unless otherwise authorized by ATC, no person operating an
aircraft may operate that aircraft according to any clearance or
instruction that has been issued to the pilot of another aircraft for
radar air traffic control purposes.