This is because the tile graphics is just graphics to the engine. It doesn't understand that it implies some geometry to the viewer.
Works when wall-graphic tile is in (0, 1) and player is in tile (1, 1).

Fails when player is inside same tile (0, 1) and base of player is lower, so assumed nearer and sorted "wrong" (although depending on the graphics it could be right, for example if it's a picture of a tree instead of a wall).

I don't have a solution yet. More discussion about this issue on flashkit forums.