Remove broken webpart in SP2010

During our migration we encountered some issues with an unsupported web part. It was no longer possible to load the page containing the web part. We used this trick to delete the broken web parts:

At the end of the broken page we added ?contents=1. On this page you can delete the web parts.