It hasn't happened in modern U.S. history. For the most part, incumbent presidents who didn't win their subsequent primaries were vice-presidents who took office after the deaths of their predecessors, namely in the 19th century. The last time there was even a legitimate challenge to an incumbent was in 1980 with Ted Kennedy challenging Jimmy Carter. And to be honest, if the democrats couldn't even get rid of Jimmy Carter, then chances now or in the future of a president not getting nominated again are slim to none.
Then again, Kennedy did himself no favors with his hubris, being out of touch with the people, unlike his brothers who mastered that ability, and he couldn't even give a legitimate answer as to WHY he wanted to be president. his interviews back then are hilarious and embarrassing at the same time. As if he thought being a Kennedy gave him a god given right to be president.