Finally got it.
wBf8 could only have reached that square by promotion, and the pawn can only come from a2, capturing 5 Black units.
Black must have made 2 P captures, d7xe6 and cxd.
Now, the tough part: How to free the Kings? Black will uncapture an wN ASAP, then N will go to e1 and uncapture an R, which will shield bK so it can go to e1, allowing the wK to go to f3 and escape, at which point the position unwinds. The only thing left to explain is how bRe1 got in there. The only possible explanation is that wPg and wPh cross-captured. This means that White captured every other missing piece with pawns, and Black can't retract d7xe6 until Bc8 is home.
The retraction runs something like:
-1...c6xNd5 -2.Nb4 h6 -3.Nd3 c7 -4.Ne1 h7 -5.Nd3xRe1 Rf1 -6.Nb4 Ke1 -7.Nc3 Kd1 -8.Nb5 and now Black and White both have freedom of movement.
It is too soon to return bK to e8 - the unpromoting wPf7 disturbs him on the way back. Furthermore, White must have captured bPf7, because it could not have left the file. The 7th rank will be completely closed off after retracting d7xe6 for Black and e6xf7 for White. This means bQ, bBc8, bRh8 and bK must all be on the 8th rank before the pawns retract.
Now, where to put bK on the 8th? bBf8 blocks g8 and h8 for the bR, and bQ and bB need d8 and c8. The bR must go on e8 until Bf8 unpromotes. g8 is out for bK because (again) Pf7 disturbs him. The only square left is h8.
And the only way to get the R back to h8 is by uncastling. Black's first King move was 0-0.
Originally posted by BigDoggProblemExcellent analysis!
Finally got it.
wBf8 could only have reached that square by promotion, and the pawn can only come from a2, capturing 5 Black units.
Black must have made 2 P captures, d7xe6 and cxd.
Now, the tough part: How to free the Kings? Black will uncapture an wN ASAP, then N will go to e1 and uncapture an R, which will shield bK so it can go to e1, all ...[text shortened]... the only way to get the R back to h8 is by uncastling. [b]Black's first King move was 0-0.[/b]
And the solution is correct 😀