Momentum operator representation If $\hat{p}$ acts on position eigenstate, it is
$$\tag{1}\hat{p}\left|x\right\rangle=+i\hbar\frac{\partial }{\partial x}\left|x\right\rangle .$$
But in general $$\tag{2}\hat{p} = -i\hbar \frac{\partial }{\partial x}.$$
Where does the sign difference come from?
 A: OP's ket first equation$^1$ 
$$\tag{1} \hat{p}|x\rangle ~=~+i\hbar\frac{\partial |x\rangle}{\partial x}$$ 
is explained in eq. (7) of my Phys.SE answer here. In short, eq. (1) is consistent with the corresponding bra equation
$$\langle x |\hat{p} ~=~-i\hbar \frac{\partial \langle x |}{\partial x} $$
via Hermitian conjugation. The bra equation in turn is related to OP's second equation 
$$ \tag{2}\hat{p} ~=~ -i\hbar \frac{\partial }{\partial x} $$
via the standard convention
$$\psi(x)~=~\langle x | \psi \rangle$$
for the wave function.
--
$^1$ Both sides of the ket equation (1) are kets in an appropriate infinite-dimensional vector space. (Warning: not a Hilbert space, cf. e.g. this Phys.SE post and links therein.). One can multiply eq. (1) from left with a bra $\langle \psi |$ [belonging to an appropriate (possibly different) infinite-dimensional vector space] to achieve an equation
$$\hat{p}\psi(x)^{\ast} ~=~\langle \psi |\hat{p}|x\rangle ~\stackrel{(1)}{=}~+i\hbar\langle \psi |\frac{\partial }{\partial x}|x\rangle ~=~+i\hbar\frac{\partial \langle \psi |x\rangle}{\partial x}~=~+i\hbar\frac{\partial \psi(x)^{\ast}}{\partial x},$$ 
where both sides are complex numbers.
A: The point is that your equation (1) does not make any sense. On the left side, you have operator acting on a vector in some abstract vector space. On the right side you have the position representation of momentum operator acting again on the same abstract vector. Those objects live in different spaces, you cannot just multiply them (actually you can if you define what is a derivative in a infinite dimensional space). What you really have is
$$\hat{p}|x\rangle = \int dx' |x'\rangle \langle x' |\hat{p} |x \rangle=  -i\hbar\int dx' |x'\rangle \frac{\partial}{\partial x} \delta(x'-x).$$
At this point you can not simplify this equation any further.  If you multiply this equation by some vector $|\psi \rangle$ and then integrate by parts you will see that the sign is different. 
When you see equations like 
$$\hat{p}= -i\hbar \frac{\partial}{\partial x}$$
they do not mean that operator $\hat{p}$ is equal to $  -i\hbar\frac{\partial}{\partial x}$, but rather that the operator $\hat{p}$ in position representation is equal to $  -i\hbar\frac{\partial}{\partial x}$. To be more precise 
$$\langle x' |\hat{p} |x \rangle=  -i\hbar   \frac{\partial}{\partial x} \delta(x'-x).$$
In your equations you mix up abstract notation with specific representation. This often leads to confusion.
A: may be you can think this way.
The wavefunction $|x\rangle=e^{i(kx-\omega t)}$
How do we extract the momentum $\hbar k$ out of it by some operator ?
$$
\frac{\partial}{\partial x}|x\rangle=ik|x\rangle
$$
to get $\hbar k$, you need to either multiply the operator with $-i\hbar$ or with $\frac{\hbar}{i}$.
So the momentum operator is
$$
\hat{p}=-i\hbar\frac{\partial}{\partial x}=\frac{\hbar}{i}\frac{\partial}{\partial x}
$$
The equation is
$$
\hat{p}|x\rangle=-i\hbar\frac{\partial}{\partial x}|x\rangle=\frac{\hbar}{i}\frac{\partial}{\partial x}|x\rangle
$$
