Should I accept an invitation to give a talk on dated work?
I'm a physics PhD student, so our culture is a little different, but I've seen people give talks that were primarily about work published multiple years ago. So if math culture is anything like physics culture (and what I've heard suggests that the time scales are even longer for you), I don't think it's a bad idea. Especially, considering the fact that you have been invited to give this talk, it seems they want you there despite knowing that your work will have been out for a long time by the time the conference happens.

If you want to inject something new into it, you could consult with some colleagues in subject Y and ask them what the relevance of your counterexample is. Then you could finish your talk with an overview of what they tell you.