In theory, yes. Opiates are CNS depressants, enough will knock you unconcious and stop your breathing, which is how they generally kill. (Death by asphyxiation on your own vomit is another way.)
That being said, with recriational opiates these days being almost 100% filler/cutting chemicals, it can be hard to get enough for a certain hot dose these days. You might have a hard time injecting enough very impure street drugs to guarantee a fatal overdose (I'd guess the drugs woukd probably knock you out or make you too lethargic to shoot up more first, especially as a first time user) ... then again, so many people fatally OD accidentally, it can't be that hard, if you're trying, so maybe.
It's how I'd go out if I knew I could get enough pure opiates - a peaceful death with a drug-induced euphoria going on does sound nice.