If you can clean out the channel in the bottom rail and work it back onto the wall, you could tamp more crusher underneath to get the rail back in place. I wouldn't dig for fear of dropping the rail more. Probably should also address whatever cleared it out in the first place. Also some sort of backfill to keep it from happening again.

Good luck, let us know how it's going. Welcome to Pool Forum.