Wiggums,
Again, if you endorsed him, it counts. If you endorsed him for a retake after he failed with someone else, it still counts because you endorsed him. One failed student for you.
There's more. If you endorse him and he fails, it counts as a failure for you. If you endorse him and he fails again, he counts as another failure. And another, and another, so long as it keeps happening. You're held responsible for each recommendation, and every time you recommend (ad infinitum) and the student fails, it counts to your detriment. In this case against your ability to obtain a gold seal, and ultimately against your ability to hold a flight instructor (and possibly airman) certificate.
The first run (first-time applicant) requirement only applies to the successful applicants you can count for the gold-seal requirement.
As an example, you have 10 total students. Two fail, but both pass on their second attempt. You are acceptable, as you still have an 80% first time pass rate.
You have 10 total students. Three fail, but pass on their second attempt. You are not eligible for the gold seal certificate, because these didn't pass on their first attempt. You have made 13 recommendations (10 the first time around, and three the second). 80% must pass on the first try. You had 70% pass on the first try.
You have 15 students. Ten pass on the first attempt two on the second attempt. You have a 67% initial pass rate, and are liable for certificate action. You will be placed under surveilance. Your overall pass rate, after recommending all five of the first-time failures, then drops to 60%. With the initial pass rate so low, and the second time pass rate at only 40%, you are then almost certain to face certificate action.
Again, a good reason to ensure a student is ready before recommending him or her for a certificate, rating, or knowledge test.