In the end of The Departed, Matt Damon's partner comes to his rescue, shooting Leonardo DiCaprio's character along with the friend whom Leo had asked to come to Damon's arrest as protection.
My question: How did the partner know to come? Damon looked stunned when the character showed up (he was in fact begging DiCaprio 'kill me') and the character further gives away to the audience that Damon didn't know he was also working for Costello ('you think you're the only guy he had on the inside?').