Considering what happens to the partition function in the $\delta m \rightarrow 0$ limit is not really a sensible question for fermions and bosons, because "nearly identical" is nearly a quantum oxymoron. There is no smooth $\delta m \rightarrow 0$ limit in quantum mechanics that can convert non-identical particles into identical particles. If all their other intrinsic properties are the same, they are not identical if $|\delta m| > 0$, but they are identical if $\delta m = 0$. The transition between the two is discontinuous. This binary difference between identical and non-identical particles is fundamental in quantum mechanics, as is discussed in the answer to Almost identical fermions fighting for the same state.
I find it helpful to think about how two particles can possibly differ in quantum mechanics, and how mass differences are always associated with different quantum numbers. If two particles $A$ and $B$ are identical except that their rest masses differ, then $A$ and $B$ can simply be considered to be different states of the same particle, since there is nothing to prevent $B\leftrightarrow A$ transitions (e.g. by decay or collision or mixing). In any quantum theory describing $A$ and $B$, this means that state $B$ must have at least one quantum number whose value differs from state $A$, so they are not identical “particles” no matter how small $\delta m$ is.
For example, $A$ and $B$ could be hydrogen atoms in their $1S$ and $2S$ states. It is not just their tiny mass difference ($\sim0.000001\%$) that makes the $1S$ and $2S$ atoms distinguishable, but that their principle quantum numbers $(n=1,2)$ differ by $1$, corresponding to different internal quantum states and wave functions. Even if the electron was much lighter, making the mass difference between the two hydrogen states much smaller, their principle quantum numbers would still differ by $\Delta n = 1$.
Or consider the $1S$ hydrogen $F=0,1$ hyperfine states that differ in mass by less than $0.0000000000001\%$. Again the mass difference is tiny, but their angular momentum differs by $\Delta F = 1$, depending on whether the electron and proton spins are parallel or antiparallel.
Of course, explicit internal structure is not the only way mass differences can occur. For example, masses of fundamental particles in the Standard Model are generated by the Higgs Mechanism, and a popular explanation for why neutrinos are so light is the Seesaw Mechanism. What all these methods of generating mass share, however, is that different masses are always associated with different quantum states.
In a fully quantum system, otherwise identical quantum particles cannot differ only in mass. Any mass difference is associated with a difference in their intrinsic quantum properties that make them non-identical no matter how small the mass difference is. The transition from non-identical to identical particles requires changing the quantum state of the particles, which causes the dramatic changes in the partition function.