Portsmouth beat second-from-bottom Leicester City to leave the Foxes in real danger of being relegated from the Championship.