The technical term I have heard in writing is resonance. In psychology, we would call it priming of the audience.
As you say, it isn't exactly foreshadowing, but it puts an image into the reader/viewer mind, perhaps even subconsciously, so her metaphor a little later seems more significant than if it stood on its own. It seems more apropos, as if she remembers that beat up guitar, too. The phrase also resonates with a cliché, "he played my like a fiddle."
These resonances are usually introduced in later drafts; as an author you know what is coming up, and you can work it into dialog. For the Dexter episode you are talking about; the author may have written "played me like a fiddle,", then in a second draft while eliminating clichés come up with the $20 guitar, then decided that needed some support, and moved back further in the script to plant the $20 guitar as a resonant moment. Every single second counts in a screenplay, so this is a cheap visual that doesn't cost him any screen time. Good screen writers use a lot of little visual tricks like this; although this one was pretty obvious.
In Psychology there are extensive "priming" studies, in which people are exposed to sensations or images subconsciously (not by flashing them on the screen) and then this is shown to influence their thinking.
For example, one researcher hired students to view photographs, and describe their personalities. One at a time, she arranged to meet them in an empty classroom; but she arrives late, with books in one arm and a coffee in her hand. She asks the student to hold her coffee, while she unlocks the door. Then the student is given a stack of photos of faces; all neutral expressions, and a multiple choice test to evaluate their personality and profession, choosing one of five possible words.
The trick is, for half the students, the coffee was iced coffee (cold), and for half the students, it was warm coffee. They are given exactly the same materials, but the students that held cold coffee selected words to describe these people that are associated with "cold" personality traits: Calculating, strict, prefers to work alone, etc. Twice as often as the people that held warm coffee; and vice versa: Those that held warm coffee described people as friendly, having a sense of humor, working well with people.
That is "priming". Holding cold coffee will subconsciously activate connections to everything you have ever heard described as "cold", including people. This in turn, when you lack any evidence, makes those neurons more likely to fire. Given neutral faces of strangers, you don't know enough to assess their personality, so the words that "resonate" are the ones recently and subconsciously activated.
The same thing works in print and video. It is often ham-handed: The guy about to be murdered 8 scenes from now tells his friend "C'mon, you're killing me."
But if it is done with more subtlety, the resonance is subconscious, and it just sounds like good writing or its funny, and you don't know why. Unless you are a writer and watch for the tricks.