The detective associated with foiling the suspected 1861 Baltimore assassination plot against Lincoln was Allan Pinkerton. Pinkerton organized the investigation and helped arrange Lincoln's secret passage through Baltimore on the way to his inauguration.
Railroad president Samuel M. Felton hired Pinkerton to investigate secessionist activity and threats against railroad property. Pinkerton's agents gathered reports of a possible attack on Lincoln's carriage as he traveled between Baltimore train stations. On February 23, 1861, Lincoln instead passed through Baltimore secretly at night and reached Washington safely.
The episode is often called the Baltimore Plot, but historians have disputed how serious or genuine the conspiracy was. Much of the evidence came through informants and undercover agents, and some contemporary observers believed Pinkerton had exaggerated the danger.
Pinkerton did not work entirely alone. Kate Warne played an important undercover role, and other agents supplied intelligence. Nevertheless, Allan Pinkerton is the conventional answer because he led the investigation and advised Lincoln's team.