The correct answer is C. had.
The sentence “If only he had told us the truth in the first place, things wouldn’t have gone wrong” is a conditional sentence of the second type. This type of sentence expresses a situation that is contrary to fact. In this case, the speaker is saying that if the person had told the truth, things would have been different.
The verb in the if-clause is in the past perfect, which is used to talk about events that happened before another event in the past. In this case, the event that happened before is “things went wrong.” The event that the speaker is imagining is “he told us the truth.”
The verb in the main clause is in the past conditional, which is used to talk about events that would have happened if something else had happened. In this case, the speaker is saying that if the person had told the truth, things would not have gone wrong.
The other options are incorrect because they do not express a situation that is contrary to fact. Option A, has, is in the present perfect, which is used to talk about events that have happened up to the present. Option B, would have, is in the past conditional, but it is used to talk about events that would have happened if something else had happened in the past. Option D, should have, is in the past modal, which is used to talk about events that should have happened but did not happen.