Dear Brother Moses2006,
When Peter began his message, he said, "Ye men of Judaea, and all ye that dwell at Jerusalem" (v.14). Again, in v.22 he said, "Ye men of Israel, hear these words". Again in v.36 he says, "Therefore let all the house of Israel know assuredly, that God hath made that same Jesus, whom ye have crucified, both Lord and Christ."
So clearly he was addressing the children of Israel.
In v.37, some people responded - " Now when THEY heard this, they were pricked in their heart, and said unto Peter and to the rest of the apostles, Men and brethren, what shall we do?"
Ac 2:40 And with many other words did he testify and exhort, saying, Save YOURSELVES from this UNTOWARD GENERATION.
41 Then THEY that gladly received his word were baptized: and the same day there were added unto them about three thousand souls.
"YOURSELVES" of v.40 are the same as "THEY" of verse 37 - those who were pricked in their heart.
Untoward generation would be those who have mocked at them in verse 13, and/or those who DID NOT respond with a pricked heart to Peter's message. While all of them "have taken, and by wicked hands have crucified and slain" the Lord, the untoward generation are those Israelites other than the ones who were pricked in their heart, and then received the word gladly later in verse 41.
"THEM" in verse 41 (as you have highlighted) are Peter, and the other 11 apostles with him, plus the 120. Those who were added were added to already existing group of Lord's people.
Let me know if this explains.
In Christ Jesus,