Okay let’s try a few reset configurations. Can you go in C:\Users\UserName\.platformio\packages\tool-openocd\scripts\board\ in the file stm32f4discovery.cfg, instead of the line reset_config srst_only, test these options in sequence:
reset_config nonereset_config none separatereset_config srst_onlyreset_config srst_only srst_nogatereset_config srst_only srst_nogate connect_assert_srstreset_config trst_and_srst srst_nogate connect_assert_srst
Ideally test the same config twice, once with NRST connected to the probe and one go without it connected.
Only those are interesting for which the openOCD error is different.