Carlton Cole and Mohamed Diame made the difference after West Ham came from a goal down to beat Chelsea 3-1 at Upton Park.