The comment you refer to is not understandable and it does not work.
That your approach is wrong can be seen already from the fact that it can give negative probability for $m>n$, which is a nonsense as the general expression should of course describe this case as well. The reason for this error is the hidden assumption that all male students have different birthdays. This can be demonstrated already for the case $m=2$. Indeed the correct complementary probability is:
$$
\frac1{365}\left(1-\frac1{365}\right)^f+\frac{364}{365}\left(1-\frac2{365}\right)^f,
$$
where the first and the second terms refer to the cases when the male students have the same and different birthdays, respectively. This probability is higher than the expression based on your calculation:
$$
\left(1-\frac2{365}\right)^f.
$$
For the general case of arbitrary $m$ we need to solve the following basic problem: find the number of ways to put $m$ distinguishable balls into $n$ distinguishable bins so that no bin is empty. The problem is very-well known and can be easily dealt using inclusion-exclusion method.
There are $n^m$ ways to fill $n$ bins with $m$ balls. From this we shall subtract the distributions with at least one empty bin. There are $\binom n1(n-1)^m$ such distributions. But doing so we doubly subtract the distributions with at least two empty bins, so we have to add their number $\binom n2(n-2)^m$ back. Now we however multiply added the distributions with at least three empty bins and have to subtract them. Finally one obtains the expression:
$$
{\cal D}_n^m=\sum_{k=0}^n(-1)^k\binom nk(n-k)^m:=n!{m \brace n},
$$
where ${m \brace n}$ is the Stirling number of the second kind, which is essentially defined by the same counting problem but with indistinguishable bins. The symbol ${\cal D}_n^m$ is not standard but in probability problems you will almost always deal with this quantity rather than with "pure" Stirling numbers.
Equipped with ${\cal D}_n^m$ you can easily solve the initial problem. Just choose a subset of $r$ bins to fill with white balls (no empty bins are here allowed!), count the number of ways to distribute the white balls to these bins (this is ${\cal D}_r^m$) and multiply it with the number of ways to distribute the black balls between the rest of bins (here empty bins are allowed!). Finally sum the results over all possible non-empty "white" subsets. In this way you will obtain the same answer which was given in your reference.