STM32 & ST-LINK - Cannot connect to MCU after successful programming
I managed to solve that problem. If anybody encounters similar problem, here's what I've done:

I used ST-Link v2 and ST-Link Utility. In setting, I set "Connect under reset" and SWD interface (I'm not sure about frequency).
Then I press the reset button on my board and clicked "Target" -> "Erase chip" and just after clicking I released the button - It erased the chip so I can now reprogram my MCU.



Anyway, if you need to use SWD pins as output, then add some delay at the beginning of the program or use some jumper to disable/enable setting these pins as outputs.