This requires a judgement call by the TD. Checkmate ends the game, even if the player’s flag falls before he can stop his clock. If Black gave mate before his flag fell, he should be given the point. If his flag fell before he completed the checkmating move (by releasing the piece on the square), he loses on time. If the TD cannot determine which is the case, he must exercise his discretion. In the case you describe, I think that I’d rule the time forfeit stands, on the grounds that the players implicitly conceded that the second case was what happened, by shaking hands and agreeing to the time forfeit. But I’ll admit that another TD might make a plausible argument the other way.