Video in Sony Vegas flickers and is full of black frames
While I wasn't able to fix the problem, I was able to go around it, by converting my input file into xvid.

I don't have any black frames anymore, but the video freezes for a few seconds at some point.

Since I was recording and playing the game on the same PC, I'm guessing that there's been a problem at some point and fraps had to drop the framerate.

In any case, I suspect some other bug in my video editing setup, since Vegas was adding black frames in other parts of the video, that play fine once converted to xvid.