Hi Soeren Birth,
Please try our KSDK2.2_FRDM-K22F120M flash code.
You can download the KSDK2.2 code from this link:
Welcome to MCUXpresso | MCUXpresso Config Tools
Click SDK builder, choose board as FRDM-K22F, this board's chip is MK22FN512VLH12, after generate the code, and download it, you can find the flash code in folder:
SDK_2.2_FRDM-K22F\boards\frdmk22f\driver_examples\flash\pflash\iar
I changed the erase flash sector address below 0x3FFFF, take an example:0x3f800, I can do the flash sector erase, program, erase again succesflly.
So, please try this code.
Modify the pflash.c line destAdrss to 0X3F800, like this:

After program the 0X3F800, the according address will have data:

Do the flash sector erase again

You can find the sector in address 0x3f800 is erased again.
When you run the code in the flash, please make sure your erased sector is not in the code sector, otherwise it may damaged your application code, you can check the code size whether it is in your erased flash sector.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------