The real solution is to remove the paint or to replace the trims so a good bonding paint is the key. Two products that do a decent job of avoiding stripping the paint to fix the problem are Paso and Liquid Sand Paper. Both products sort of melt the latex paint and oil paint both into a homogeneous goo or sludge that sticks together better. Clean the painted surface, apply the Paso of Liquid Sand Paper and follow the directions to apply the paint top coat. Remember the real answer is to strip the poor paint off or replace the trim and paint it or stain correctly. However these products offer an alternative.