In Oscar Wilde's play The Importance of Being Earnest, Act III, it is discovered that Jack Worthing's father's name is, in fact, Ernest. This, in Wilde's own comical way, would then make Jack "worthy" of inheriting his father's name and, for that reason, he is now a "real" Ernest.
Algernon is also the son of Jack's father which, making for the ironic nature of the play, makes him also "legally bound" that Algernon's name will also be Ernest, if desired.
Lady Bracknell: I am afraid that the news I have to give you will not altogether please you. You are the son of my poor sister, Mrs. Moncrieff, and consequently Algernon’s elder brother.
Since Algernon is the cousin of Gwendolen and the brother of Jack, it is then true that Gwendolen and Jack are, indeed, cousins. However, this is not an issue in the 1800's. When we compare this subtopic to how it is treated by Margaret Mitchell in her novel Gone with the Wind, for instance, the characters of Melanie and Ashley become engaged and marry precisely because they are cousins and Ashley gives a lot of importance to marrying "within the bloodline". In this day and age that may sound ridiculous and even somewhat gross, but it was the idea back then.
Yet, bloodlines have nothing to do with Jack's decision to marry Gwendolen. They are quite unaware of their connection until the end of the play.