I guess Audacity's compressor doesn't allow you to change the release. But it looks like changing the attack made a difference in knocking down the peaks you mentioned earlier, as expected. Don't sweat the release too much, it looks like the compressor's working just fine.
The reason the compressor is modifying the entire selection: the entire selection is above the threshold (-20 dBFS). Draw a straight, horizontal line across the waveform at the -20 dBFS marker. (see attached) The compressor will act on portions of the waveform rising above the line, but not portions of the waveform falling below the line. As the attached image shows, with the threshold at -20 dBFS, the entire selection is at or above the threshold. Hence, the compressor impacts the entire selection.
Honestly, the levels look just fine in the original, but my perception may be skewed by the duration. What's the duration of the selected waveform in the images?
Also, maybe taking a step back will help: what is the audible problem you're trying to solve, and what are the problem's audible symptoms?