Yea, there's something wrong in these lines in main.cpp:
if (vtx[0].GetValueOut() > GetBlockValue(pindex->pprev->nBits, pindex->pprev->nHeight, nFees))
return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetValueOut(), GetBlockValue(pindex->pprev->nBits, pindex->pprev->nHeight, nFees)));
and
int64 reward = GetBlockValue(pindexPrev->nBits,pindexPrev->nHeight+1, 0);
It's using the difficulty/height from the previous block instead of the current block.