Do “researcher degrees of freedom” invalidate my analysis?
Clearly report what you did and both results.  Readers will make up their own minds about the strength of the findings.

The situation that you have encountered is very common.  While testing a prior hypothesis with predefined methods is the right thing to do, in practice it is unavoidable that you will sometimes find problems that you need to correct after running an initial analysis.

Also, if your analysis produces an unexpected result, it is quite logical that this will lead to extra checking of what you have done, and further analyses to confirm it.  

There's nothing wrong with doing extra things to refine the analysis. The problem would be refining the analysis and then failing to report on earlier versions.

A multiple testing correction would not typically be used for only two analyses.   Furthermore, it is a judgement call whether this counts as two tests or one.  If the second analysis was really the "correction" of something flawed, that is not quite the same as repeating two different but valid approaches.  And there is not a clear line as to when that becomes true.

In summary, there is no problem with what you have done, as long as you report it, but your concern with doing this the right way is a very good thing--please keep it up!  Inadequate reporting of this sort of thing is quite common, and it undermines the quality of scientific evidence.