Major histocompatibility complex (MHC) genes encode proteins that present pathogen-derived antigens to T-cells, initiating the adaptive immune response in vertebrates. Although populations with low MHC diversity tend to be more susceptible to pathogens, some bottlenecked populations persist and even increase in numbers despite low MHC diversity. Thus, the relative importance of MHC diversity versus genome-wide variability for the long-term viability of populations after bottlenecks and/or under high inbreeding is controversial. We tested the hypothesis that genome-wide inbreeding (estimated using microsatellites) should be more critical than MHC diversity alone in determining pathogen resistance in the self-fertilizing fish Kryptolebias marmoratus by analysing MHC diversity and parasite loads in natural and laboratory populations with different degrees of inbreeding. Both MHC and neutral diversities were lost after several generations of selfing, but we also found evidence of parasite selection acting on MHC diversity and of non-random loss of alleles, suggesting a possible selective advantage of those individuals with functionally divergent MHC, in accordance with the hypothesis of divergent allele advantage. Moreover, we found that parasite loads were better explained by including MHC diversity in the model than by genome-wide (microsatellites) heterozygosity alone. Our results suggest that immune-related overdominance could be the key in maintaining variables rates of selfing and outcrossing in K. marmoratus and other mixed-mating species.