Found a major flaw in paper from home university – to which I would like to return During my Ph.D. in condensed-matter physics, I published a paper together with two other students. The research group of the university that I am originally from (in Madrid, Spain) happened to work on the same subject and, later on, published another paper where they criticize our work, propose their own, and claim that theirs ‘works’ better. This group includes a famous and highly influential professor. 

I could finally get around to study their results, reproduce every single bit of them, and found a major flaw, which invalidates their conclusions, including the superiority of their approach over ours.

I am now a permanent researcher in another country, but would like to go back to Madrid some day for personal reasons. It is a small world, and it is likely that I will have to interact/negotiate with that group if I ever want to go back. 

On the one hand, I would like to publish this work where I found the flaw, in order to get things straightened out and properly settle the scientific issue. On the other hand, this may cause a strong embarrassment for them and be detrimental on a relational/political level, possibly implying a revenge from their side. 

I could certainly write them a polite email before publishing, trying to be as delicate as possible and frame the whole thing in a positive way. However, I doubt that this will make a difference on the long term. 

How can I deal with this? Have you ever been in a similar situation?
Don't make it personal. Keep it about the science. You can inform them of the flaw and let them fix it or you could just publish a new paper with better results, pointing out the flaw if needed. That would depend on whether you want the new result under your name or are happy enough for it to be under theirs. 

If you write, however, and get pushback, evaluate it fully and then publish or not as you choose. But I wouldn't get into an argumentative back and forth about it. And if you just decide to publish it, as a courtesy you can send them your paper when you submit it to a publisher: For Your Information...

The science is the important thing.