Terry Wickett makes a horrible first impression on our hero Martin because the he's super rude and abrasive. But the more we get to know Terry, the more we realize that there's a good guy lurking beneath his sarcastic exterior. As Martin quickly realizes,
Wickett's snarls were partly a Clif Clawson misconception of humor, but partly a resentment, as great as Gottlieb's, of the morphological scientists who ticket things with the nicest little tickets, who name things and rename things and never analyze them. (26.5.22)
In other words, Terry might be kind of unpleasant to be around, but he's a great scientist and every bit as devoted to research as Martin is. And there is nothing Martin respects more than devotion to science. Of course, there are still times when Terry annoys him, but Terry is always quick to let Martin know when he's being serious, like when he responds to Martin's temper by saying, "Well, for Pete's sake, Slim, don't worry. The old man and I were just egging you on" (27.5.14). Aside: how awesomely antiquated is that sentence? We're going to start calling more people "Slim."
We see Terry's loyalty come out when he is the only person at the McGurk Institute who comes to the harbor to say goodbye when Martin and Leora leave for the Caribbean: "Only Terry came to see them off, bringing a box of candy for Leora" (32.4.3).
And, by the end of the novel Terry is the only ally Martin has left. The two of them retreat to a shack in Vermont so they can spend the rest of their lives together pursuing their scientific interests. With Leora dead, there's no one in the world who Martin is closer to than Terry.