Agree with both. Brain fart on my part. Can't count on counter++ and counter-- being atomic. Simply surrounding them with noInterrupts() / interrupts() pair would fix that.
When I pointed out the flaw in the original code, I explained the problem in detail so the OP could understand. Like I said, my brain fart missing the follow-on issue.
Don't know why @CB chose to be a jerk and recommend guessing games ("go search for my posts on the internet") instead of providing a concise explanation.
And the ISR begins with interrupts disabled. The variable must be volatile.
If the incrementing is done in the ISR, reading the count without cli() ... sei() would get the very latest count that might update RAM before the sketch reads RAM.