Invalid thread id: 1
Kept trying and got two more data points to isolate the issue: the problem only occurs for breakpoints that are placed in an interrupt handler. Breakpoints placed outside of an interrupt handler work fine. I can have as many as I want and the debugger single-steps and resumes fine.
In my case the breakpoint that causes the issue is in the SysTick_Handler. If the debugger stops in that handler, it either is dead immediately, or stops working after some steps. The pattern that I can observe is that it always happens on branch with link (BL) instruction. Not necessarily the very first one encountered, but after a few such instructions it does so for sure. No recursion in my code, maximum nesting is one level. The code worked before and the subroutines return via BX LR normally as long as the debugger is alive.
EDIT: exchanged the ST-LINK and the cable against known good ones - didn't help