Giles Corey does not function solely as comic relief in The Crucible though he does present some of the few funny moments in the play. Functionally, Corey serves to contextualize John Proctor's position in the community and his position on the witch trials.
Corey is more extremely independent than any other character in the play. He does not care what others in Salem think of him and he does not feel beholden to the norms of the community. That is why he is willing to sue so readily when he is crossed.
He didn' t give a hoot for public opinion, and only in his last years did he bother much with the church.
In these ways he is more extreme and more independent than John Proctor. Without the presence of Corey in the play, we might think that Proctor is a fringe character making extreme choices. The judges and Reverend Hale certainly articulate an opinion that Proctor is rather extreme in his independence because he planted on a Sunday and did not baptize one of his children.
However, as we see from Corey, there are people who go much further in their disregard for the constraints of the community norms. Corey can be said then to represent the dissenters and those outside the pale of the rigidly defined, value-driven community of Salem.