Meaning- in a very difficult position.
Usage- Ramesh had to choose between confessing that he hadn’t studied or trying to fake it . He was between the devil and the deep blue sea.
Origin- in the early 17th century the heavy plank fastened to the side of a vessel as a support for guns was called the devil. Sometimes a sailor had to go out onto this plank to do repairs to the boat . In heavy seas he would be in a great danger of falling overboard and drowning because he was between ” the devil and the deep blue sea” .