The expression “to keep one’s pecker up” means: To maintain one’s courage or resolution; not to get down in the mouth; to keep a stiff upper lip.
In fact, we might say that “lip” and “pecker” are two terms for the same thing, as the lip corresponds with the beak or pecker of a bird.
The expression dates to about the middle of the nineteenth century.