Longer than 40 years. Ted got the seat in 1962, taking over from a chair-warmer who held it until Ted was old enough to be a Senator. The seat was previously held by Ted's brother John F Kennedy, who won it from Republican Cabot Lodge in 1952.
So we just won a seat that had been continuously Democrat for 58 years! That's GOT to make some Dems sit up and take notice.