Twelve years after competing in his last Olympics as a 19-year-old, Ervin qualified for his second United States Olympic team as a 31-year-old at the 2012 United States Olympic Trials in Omaha, Nebraska, by finishing second in the men's 50-meter freestyle. His time of 21.60 seconds was only one one-hundredth (0.01) of a second behind Cullen Jones (21.59) and also a personal best for Ervin. At the 2012 Summer Olympics in London, he finished fifth in the finals of the 50-meter freestyle with a time of 21.78 seconds. Ervin made history with Jones and Lia Neal by being the first African-Americans on a U.S. Olympic swim team with more than one African-American swimmer.