Actually, it was in response to neither- the Titans were leaving after interrogating Jason about Duela's death. Jason told them something about "the next time they wanted to kick his ass, don't hide behind some investigation" or whatever, so Tim kicked him in the crotch and told him to consider it "next time."
So, in that context, it was somewhat unwarranted, but given that this is set (considerably) after Jason beat the shit out of Tim for no good reason, I think that Tim kind of deserved to get that hit in.