The formation and maintenance of the Nothofagus beech gap in the South Island, New Zealand, has been the focus of biogeographical debate since the 1920s. We examine the historical process of gap formation by investigating the population genetics of fungus beetles: Brachynopus scutellaris (Staphylinidae) inhabits logs and is absent from the beech gap, and Hisparonia hystrix (Nitidulidae) is contiguous through the gap and is found commonly on sooty mould growing on several plant species. Both species show distinctive northern and southern haplotype distributions while H. hystrix recolonized the gap as shown by definitive mixing. B. scutellaris shows two major haplotype clades with strong geographical concordance, and unlike H. hystrix, has clearly defined lineages that can be partitioned for molecular dating. Based on coalescence dating methods, disjunct lineages of B. scutellaris indicate that the gap was formed less than 200 000 years ago. Phylogenetic imprints from both species reveal similar patterns of population divergence corresponding to recent glacial cycles, favouring a glacial explanation for the origin of the gap. Post-gap colonization by H. hystrix may have been facilitated by the spread of Leptospermum scoparium host trees to the area, and they may be better at dispersing than B. scutellaris which may be constrained by fungal host and/or microhabitat. The gap-excluded species B. scutellaris is found in both beech and podocarp-broadleaf forests flanking the Westland gap and its absence in the gap may be related to incomplete recolonization following glacial retreat. We also discuss species status and an ancient polymorphism within B. scutellaris.