Peterborough were relegated to League One after losing 3-2 at Crystal Palace, who face Brighton in the play-offs.