How can investigators trust flight instrumentation from aviation accidents?
Investigators have experience in inspecting damaged equipment. Over the years they develop an understanding of what kind of damage comes from crashes. Based on this experience they can determine whether the damage is consistent with a crash or just typical operation.

As raptortech97 commented, the gyro from Copa 201 had a wire nearly severed. This is exactly the kind of normal damage that could happen to a gyro in operation, but not the kind of damage that would happen inside a gyro during a crash.

Of course there are many instances where investigators are unable to determine whether equipment was damaged before the crash. Items may be too badly damaged to determine this.

The comment about USAir 427 is also relevant. See also British Airways 38. Some failure modes leave no evidence behind, and thus are difficult to diagnose afterwards.

The investigation will take all of these factors into account along with all other evidence they have. They will not claim a definitive answer based on uncertain test results alone. In the case of Copa 201, the data from the FDR matched the behavior of a gyro with a loose connection, which matched the circumstances of the crash. In the case of the 737 PCU (USAir 427) and RR FOHE (British Airways 38), once the failure mode was tracked down, it was tested in the lab to confirm that such a failure was possible and could cause the expected effects, and to determine the best method to prevent it in the future.