What to do when the claims in a paper are proven to be wrong? What can be done to correct an error that might be hiding a certain author's sole purpose of publishing a paper, no matter the soundness of their method? 

In a nutshell, the particular case that spawned this question can be summarized in a few sentences:


a paper presents a mathematical construction and proposes a numerical solution for the resulting nonlinear optimization problem
the problem has many local solutions that are not numerically distinguishable
it is impossible to ensure convergence to the real solution without actually starting near it
there are too many local solutions (an infinite set in some cases) to simply test the best sample
the authors claim unconditional convergence to the true solution, regardless the parameters
their results are consistent with their goal, but the mathematical formulation is in contradiction with the conclusions simply judging by the properties of the objective equations.
Hence, such results are, at best, a stroke of luck, if not part of a probably much different approach. 


After spending almost one month trying to understand not one, but a series of three inter-linked articles on a scientific subject, I have mathematically proven that the central assumptions and claims in that series of papers were wrong and/or incomplete. As the papers were peer reviewed and even published in reputed journals or conferences, I feel there is a need of saving other people the trouble of wasting valuable time trying to reproduce a falsely advertised behaviour. What is the proper action to take in this situation (for example, writing to the editors of the journal)?
Write a paper explaining what the errors are and how they invalidate the results of the papers in question, then submit it to a journal with good visibility and get it published. Writing directly to the journal editors is appropriate only if you have good evidence that the errors in question are deliberate (e.g., the authors have fabricated data in order to obtain the results they wanted).