Random perturbations of delay differential equations at the verge of instability and periodically driven nonlinear oscillators