The difficult part of this puzzle is the realization that the pawn on b7 can actually be black. When this is established, the rest of the puzzle can be figured out without too much difficulty. Thus, if we assume that the pawn on b7 is black, what does this entail for the other pieces? Well:
- The bishop on a8 must be white, since it must've gotten there by means of pawn promotion. This further implies that the path to a8 must've been cleared for a white pawn at some point. Hence, the pawn on a7 must be white as well.
- Next, we realize that the rook on d8 and the queen on c6 must be of the same color (otherwise both kings would be in check). Moreover, these must be of the color opposing that of the king on c8; otherwise the king on d6 would be in check by the queen and the rook, which cannot be the result of a legal move on the previous turn. This, in turn, proves that the king on d6 is of the same color as all of the heavy pieces and the knight, since it couldn't possibly be in check.
- Finally, we determine the color of the king on c8. If it were white, then the rooks, and queen must be black by the previous point. But there is no legal move on the previous turn that black could've made to achieve this. So the king has to be black, which leads us to the realization that the last move played must've been cxd8=R, since the move must've been a discovered check (Note that this implies that the pawn on b7 must indeed be black, since the arguments concerning the heavy pieces are not dependent on the color of this pawn).
So, this must be the solution (the knight is indeed the only possible piece that could be on d8 in the initial position, as pointed out by James Martin in the comments):
[FEN "B1knN3/PpP5/2QK1R2/8/8/8/8/8 w - - 0 1"]
1.cxd8=R