How can I apply a limited palette to a photo, while still keeping the value variations within the original image?
Let's talk about gradient maps
You haven't specified what software you're using, but let's assume you've got Photoshop.
Here's the image we'll be working with.
Select your color palette
Here, I've chosen 4 colors that are fairly similar to one another, giving me a limited palette.
I like to lay my palette out in the order I think I want to apply it to my image. This step is not required. Just have your color values ready.
Apply a gradient map
Click on gradient map (found in the Adjustments panel).
Input your colors as stops on the gradient.
Adjust the sliders (and maybe reorder the colors) until it looks the way you want it to look. Then, you're done!
Tip: If the color seems like it's too much, you can always lower the opacity of the gradient map layer or use some more adjustments to darken or lighten the overall image. (Try the Levels adjustment)